Forum: RSpec change() vs change{}

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F7e57474f25e19442bbd803275685b36?d=identicon&s=25 Kevin McCaughey (tentimes)
on 2012-10-24 18:26

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
This topic is locked and can not be replied to.