This is partly for myself, and partly for anyone after me…..
I have a controller generated via rspec_scaffold — yes, I know, it might not be what all the cool kids are doing, but it works. I also have restful_authentication set up to use rspec. So, when I go to add
before_filter :login_required, autotest frowns at me. After much trial and error, and googling (with false hits and things that didn’t work), I finally achieved a smiley face with the following added to my controller’s spec:
before :each do @current_user = mock_model(User, :id => 1) controller.stub!(:current_user).and_return(@current_user) controller.stub!(:login_required).and_return(:true) end fixtures :users