I’m testing methods in my ApplicationController using anonymous
class (not sure if that’s relevant). I’ve somehow broken something such
that I do not have access to the routing variables that rails generates.
So rather than having something like ‘response.should redirect_to
new_user_session_path’ I’m having to go with 'response.should
I’ve created a new project to check if I messed anything in spec_helper
something else, and I’ve been unable to reproduce outside of my current
project. I can access the route variables from other controller spec
classes, but not from the application_controller_spec.
Can anyone point me at where to look to start troubleshooting this?
$ gem list | grep rspec
class ApplicationController < ActionController::Base
redirect_to new_user_session_path return end
check for bar here
describe ApplicationController do
describe “#require_bar” do
render :text => “”, :status => 200
context "when not signed in" do before :each do controller.stub(:user_signed_in?).and_return(false) end it "should fail gracefully by redirecting to log in" do get :index # This works response.should redirect_to '/users/sign_in' # this causes: undefined local variable or method
# response.should redirect_to new_user_session_path