[rspec-users] RSpec whines when I set the value of an object
nick at deadorange.com
Wed Nov 5 15:05:20 EST 2008
On 2008-11-05, at 14:55, Fernando Perez wrote:
> And I get the following error message:
> Mock 'Order_1' received unexpected message :amount= with (50)
> Well I know that @cart.amount will be set to 50, but why is RSpec
> complaining about that?
> If I put @cart.should_receive(:amount).with(50), rspec still throws an
> error message. What to do?
Hi Fernando. The error's occuring because #amount= hasn't been defined
within the "Order_1" mock object. Try this:
More information about the rspec-users