Commit cd27ffa
Changed files (2)
app
controllers
spec
controllers
app/controllers/application_controller.rb
@@ -16,9 +16,9 @@ class ApplicationController < ActionController::Base
def ensure_valid_session
unless session[:session_id] && @current_session = Session.find(session[:session_id])
- render nothing: true, status: :unauthorized
+ redirect_to new_login_path
end
rescue ActiveRecord::RecordNotFound
- render nothing: true, status: :unauthorized
+ redirect_to new_login_path
end
end
spec/controllers/application_controller_spec.rb
@@ -26,14 +26,14 @@ describe ApplicationController do
context "when not signed in" do
it "boots you out when their is no session_id" do
get :index
- response.status.should == 401
+ response.should redirect_to(new_login_path)
end
it "boots you out when the session id is not known" do
Session.stub(:find).with(100).and_raise(ActiveRecord::RecordNotFound)
get :index, {}, session_id: 100
- response.status.should == 401
+ response.should redirect_to(new_login_path)
end
end
end