Commit 3554923
Changed files (4)
app
controllers
spec
app/controllers/application_controller.rb
@@ -15,7 +15,7 @@ class ApplicationController < ActionController::Base
private
def ensure_valid_session
- unless session[:session_id] && @current_session = Session.find(session[:session_id])
+ unless session[:user_session_id] && @current_session = Session.find(session[:user_session_id])
redirect_to new_login_path
end
rescue ActiveRecord::RecordNotFound
app/controllers/logins_controller.rb
@@ -8,7 +8,7 @@ class LoginsController < ApplicationController
def create
if @session = @login_command.run(self)
- session[:session_id] = @session.id
+ session[:user_session_id] = @session.id
redirect_to dashboard_path
else
flash[:error] = I18n.translate(:invalid_credentials)
spec/controllers/application_controller_spec.rb
@@ -12,7 +12,7 @@ describe ApplicationController do
let(:user) { User.create!(password: 'password', password_confirmation: 'password') }
let(:user_session) { Session.create!(user: user) }
- before { get :index, {}, session_id: user_session.id }
+ before { get :index, {}, user_session_id: user_session.id }
it "lets you continue to do whatever the heck you were trying to do" do
response.status.should == 200
@@ -32,7 +32,7 @@ describe ApplicationController do
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
+ get :index, {}, user_session_id: 100
response.should redirect_to(new_login_path)
end
end
spec/controllers/logins_controller_spec.rb
@@ -43,9 +43,9 @@ describe LoginsController do
end
it "creates a new session" do
- session[:session_id].should_not be_nil
+ session[:user_session_id].should_not be_nil
last_session = Session.last
- session[:session_id].should == last_session.id
+ session[:user_session_id].should == last_session.id
last_session.ip_address.should == "0.0.0.0"
end
end