[rspec-users] Where is current_user?

Harry Bishop lists at ruby-forum.com
Mon Oct 20 12:34:40 EDT 2008

Zach Dennis wrote:

> The @current_user instance variable was being set by the
> ApplicationController#retrieve_user method, but your spec was stubbing
> out the #retrieve_user method. This means that the original
> ApplicationController#retreieve_user method is not going to get called
> because you have explicitly told RSpec to stub out that method and
> return the current user from your spec. Since the original method is
> not going to get called the @current_user instance variable in the
> controller never gets set.
Hi Zack,
I put the stub in to advance the process to the MotionsController 
because without it the process hangs in ApplicationController with a 
redirect to show.
My test log shows the 302 but show doesn't get called.  Is there some 
way around that?

So far David's method of making retrieve_user return @current_user
and stubbing the protected method is_showable? works but doesn't 
recognize the inheritance that should be there for @current_user.


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

More information about the rspec-users mailing list