[rspec-users] Where is current_user?

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

David Chelimsky wrote:
> On Mon, Oct 20, 2008 at 7:30 AM, Harry Bishop <lists at ruby-forum.com> 
> wrote:
>> @current_user is retrieved in the application controller with
>> retrieve_user.
> I don't see where retrieve_user is getting called in the rspec example
> code or in the show action. Maybe it's not actually getting called
> anywhere?

I guess that is what's happening, although I have this line in the 


and the show action has a :login_required which calls :logged_in?
since MotionsController is a subclass of ApplicationController doesn't 
running the rspec test invoke the methods here:

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  before_filter :retrieve_user


  def retrieve_user
    return unless session[:user_id]
    @current_user = Person.current_auth_record(session[:user_id])

  def logged_in?
  helper_method :logged_in?

  def login_required
    return true if logged_in?
    session[:return_to] = request.request_uri
    redirect_to new_session_path and return false

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

More information about the rspec-users mailing list