[rspec-users] Problems with plugins?

Lance Ball lance at electricsheepcompany.com
Mon Feb 4 14:52:39 EST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Feb 4, 2008, at 2:34 PM, David Chelimsky wrote:

> On Feb 4, 2008 12:57 PM, Lance Ball  
> <lance at electricsheepcompany.com> wrote:
>>
>> When #add_user_to_role is called in the controller during my spec,
>> the method is run, rather than being a stub as I would expect.  Is
>> this expected and/or known behavior?  Any comments and direction are
>> very much appreciated.
>
> My best guess is that the instance of logged_in_user is not the same
> one that the controller action is using. You're going through the
> controller and passing it a key, at which point it's probably using
> that key to access the logged in user from a source that is not the
> same as your logged_in_user method in the spec.

Yes, that was my thought as well.  So, I printed the ID of the logged  
in user in the spec and the ID in the controller.  The IDs were the  
same.  After that, I sent this note to the list.

But, it turns out I should have been more thorough in my  
investigation.  Instead of printing out the ID, this time I printed  
the object itself and found:

#<User:0x303fc5c>
#<User:0x2fa9bbc>

So you are correct!  Thanks. :)

Lance

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFHp20H+EgDjU0WSaoRAnNkAJ9GpF2noGGfbfMyzXFJ3S8WxncnPACfdxHZ
ukGJeaOcZ8vnesebC7hRgD0=
=8cNF
-----END PGP SIGNATURE-----


More information about the rspec-users mailing list