[rspec-users] change() vs change{}

Kevin McCaughey lists at ruby-forum.com
Wed Oct 24 16:26:53 UTC 2012


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

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list