On Wed, Oct 21, 2009 at 1:07 PM, Alexander Seidl <[email protected]> wrote: > > But why does this filter prevents the index action from being executed?
Because returning 'false' from a filter does exactly that: it prevents the execution of the controller action. I'll bet I know what you're thinking -- you're thinking, "But I override @login_user in my example group's before(:each) code!" Yes, you did. But you didn't prevent the filter from executing, and the first line of your logged_in? method sets the value of @login_user *again*, even if it was already set. As you have it here, you'll be doing that database lookup every single time current_user is called or an action is called in this controller. I would suggest changing that first line of the filter from "@login_user = " to "@login_user ||= " -- which sets the value only if it was previously false or nil. Not only will this make your testing code work, but it'll eliminate any lookup redundancy. -- Have Fun, Steve Eley ([email protected]) ESCAPE POD - The Science Fiction Podcast Magazine http://www.escapepod.org _______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
