[rspec-users] should_change
David Chelimsky
dchelimsky at gmail.com
Tue Jun 12 07:36:53 EDT 2007
On 6/12/07, Jonathan Linowes <linojon at gmail.com> wrote:
> Hi,
> I'm wondering if I'm using should_change correctly.
> Here's what I'm doing
> http://pastie.caboo.se/69704
You've got this:
should change(SelectOption.find(:all), :size).by(4)
The problem is that the result of SelectOption.find(:all) is an
argument to #change, so it is only evaluated once. You can get what
you're looking for like this:
should change(SelectOption, :count).by(4)
or this:
should change { SelectOption.find(:all).size }.by(4)
David
> thanks
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
More information about the rspec-users
mailing list