[rspec-users] Not seeing the failure
Jarkko Laine
jarkko at jlaine.net
Wed Jan 23 13:05:06 EST 2008
On 23.1.2008, at 18.57, Corey Haines wrote:
> Nope, that still didn't work.
> Still getting
> @coupon.stub!(:user=).with(@current_user)
>
> Here's my spec and code using your recommended way:
>
> spec - http://pastie.caboo.se/142451
> code - http://pastie.caboo.se/142452
>
> If I add back
> @coupon.stub!(:user=).with(@current_user)
>
> they pass.
>
> It seems as though the understanding is that setting up your mock
> with the options (:user => @current_user) should set stubs for both
> get and set, but it doesn't. I think it just sets up the stub for
> the get.
I didn't say it would (and it doesn't and shouldn't):
> You can do it like this:
>
> @coupon = mock_model(Coupon, :user= => nil, :user =>
> @current_user, :save => true)
Note both :user= and :user.
In your pastie you only have :user
Cheers,
//jarkko
--
Jarkko Laine
http://jlaine.net
http://dotherightthing.com
http://www.railsecommerce.com
http://odesign.fi
More information about the rspec-users
mailing list