David Chelimsky wrote: > On Mon, Oct 20, 2008 at 7:30 AM, Harry Bishop <[EMAIL PROTECTED]> > 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 before(:each) controller.stub!(:retrieve_user).and_return(@current_user) 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 protected def retrieve_user return unless session[:user_id] @current_user = Person.current_auth_record(session[:user_id]) end def logged_in? @current_user.is_a?(Person) end 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 end end -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users