[rspec-users] How do I mock out the before :login_required method?

Max Williams toastkid.williams at gmail.com
Wed Feb 13 06:52:21 EST 2008

I'm having a similar problem - my application controller has the UserSystem
module included, and that's where the login_required method lives.  In a
spec for another controller, which has before_filter :login_required, i'm
trying to stub the login_required method to just return true, but i think my
problem is that i'm calling it on the class instead of an instance of


Looking at my log file, the :login_required filter is still failing, so it
looks like my stub has missed its target.  How do i call it on the actually
controller?  I've seen in another thread that "I can get the controller from
my specs" but i don't know exactly what's meant by that.
View this message in context: http://www.nabble.com/How-do-I-mock-out-the-before-%3Alogin_required-method--tp15448454p15456464.html
Sent from the rspec-users mailing list archive at Nabble.com.

More information about the rspec-users mailing list