[rspec-users] RSpec whines when I set the value of an object

Fernando Perez lists at ruby-forum.com
Wed Nov 5 15:08:42 EST 2008

> @cart.should_receive(:amount=).with(50)
> amount and amount= are two different methods :)

Thanks Dave!

So now if I test for: @cart.amount.should eql(50)

Why do I get this error: expected 50, got 0 (using .eql?)

I have to add that the @cart is not saved in DB after its amount 
attribute is set, it is only displayed in the view for the user to see 
what would be the total amount.

Does the @cart object need to be saved to be able to test it with should 
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list