[rspec-users] Not seeing the failure

Corey Haines coreyhaines at gmail.com
Wed Jan 23 16:48:35 EST 2008


Ah, I completely missed the :user= => in your snippet. Sorry about that. It
worked, though, just the way you described it. :)

Here's my spec now, wonderful:
http://pastie.caboo.se/142585

Thanks, David and Jarkko!

-Corey

On Jan 23, 2008 1:05 PM, Jarkko Laine <jarkko at jlaine.net> wrote:

>
> 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
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



-- 
http://www.coreyhaines.com
The Internet's Premiere source of information about Corey Haines
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080123/612909c6/attachment.html 


More information about the rspec-users mailing list