[rspec-users] Count error on lambda should change
dchelimsky at gmail.com
Mon Dec 13 21:45:35 EST 2010
On Mon, Dec 13, 2010 at 4:31 PM, djangst <djangst at gmail.com> wrote:
> Hi, any idea what could cause the following error in a controller
> "count should have been changed by 1, but was changed by 0"
> I'm posting to a create route using a lambda, similar to Hartl's
> example in his Rails tutorial:
> it "should create a user" do
> lambda do
> post :create, :user => @attr
> end.should change(User, :count).by(1)
> The only difference is I'm using a factory instead of an attribute
> hash. I know the action works because I can perform it manually and my
> model specs pass.
Please show us your code instead of referencing someone else's and
then describing the differences. There are so many things that could
be the source of the problem that anything anybody offers here is
going to be a guess at best.
More information about the rspec-users