Forum: RSpec change() vs change{}

Posted by Kevin McCaughey (tentimes)
on 2012-10-24 18:26
Hi,

I am doing the rails tutorial and there is a line:

expect { click_button submit }.not_to change(User, :count)

When I looked up the rspec docs and book too, I found:

change {} documentation (using curly brackets).

Could someone tell me what the difference is, and if I use a block for
the above example, what would it look like?

I am very confused about why there are two versions and can't seem to
get examples for the block {} version to see it's proper usage.

Many thanks!

Kevin McCaughey
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.