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

David Chelimsky dchelimsky at gmail.com
Wed Nov 5 15:13:44 EST 2008

On Wed, Nov 5, 2008 at 2:08 PM, Fernando Perez <lists at ruby-forum.com> wrote:
>> @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
> eql(50)?

Fernando - I'm happy to help, as are we all, but you make it difficult
to understand the context if we have to look at other email in the
thread to see the code.

Please make sure, when you ask a question, that you quote enough of
the thread so that the readers can understand what you're asking.

More information about the rspec-users mailing list