rails3, rspec2 ActiveRecord#changes error in specs
I'm upgrading my rails 2 app to rails 3. I use rspec, shoulda and factory girl in the test suite.
One particular pattern is causing an error I'm having a really hard time both researching and solving.
# cart controller spec
@cart = Factory.build(:car开发者_Python百科t, :payment_status => "authorized", :user_id => @user.id)
2.times { Factory(:cart_item, :cart => @cart) }
And I get this spec failure:
changes is defined by ActiveRecord
./spec/controllers/cart_controller_spec.rb:41
./spec/controllers/cart_controller_spec.rb:41:in `times'
./spec/controllers/cart_controller_spec.rb:41
calling the #times method is safe ( no error are thrown when I just put 2.times { puts "hi" }
) but I'm not able to see how #changes is being invoked here.
Do you have a column called 'changes'? I suspect it's clashing with ActiveRecord, you may need to rename it.
精彩评论