[rspec-users] Where is current_user?

Harry Bishop lists at ruby-forum.com
Mon Oct 20 09:29:16 EDT 2008


David Chelimsky wrote:
> retrieve_user, the real method, sets an instance variable that other
> methods expect to be set rather than returning a value. When this is
> stubbed with a *return value* of the user, the instance variable never
> gets set inside the controller.
> 
> I'd add a current_user method that returns @current_user, and then
> stub *that* in the code examples:

 Hi David,
I understand your response now that its pointed out what is happening 
between controller and rspec, however, this means changing my code to 
test it.  This strikes me as backward. Isn't there another way to get 
the @current_user "set" for use in the controller?

BTW - the actual code runs fine.

HR


-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list