Commit dc568f8d
Changed files (3)
app
controllers
spec
controllers
app/controllers/application_controller.rb
@@ -7,7 +7,7 @@ class ApplicationController < ActionController::Base
before_filter :extend_session_cookie
helper_method :current_user, :user_signed_in?
- def user_session(session_key = cookies.signed[:cookie_monster])
+ def user_session(session_key = cookies.signed[:raphael])
@user_session ||= UserSession.authenticate(session_key)
end
@@ -39,6 +39,6 @@ class ApplicationController < ActionController::Base
end
def extend_session_cookie
- cookies.signed[:cookie_monster] = user_session.access(request) if user_signed_in?
+ cookies.signed[:raphael] = user_session.access(request) if user_signed_in?
end
end
app/controllers/sessions_controller.rb
@@ -6,7 +6,7 @@ class SessionsController < ApplicationController
def create
if @session = User.login(session_params[:username], session_params[:password])
- cookies.signed[:cookie_monster] = @session.access(request)
+ cookies.signed[:raphael] = @session.access(request)
redirect_to my_dashboard_path
else
flash[:error] = "Ooops... invalid email or password."
@@ -15,7 +15,7 @@ class SessionsController < ApplicationController
end
def destroy
- cookies.delete(:cookie_monster)
+ cookies.delete(:raphael)
redirect_to root_path
end
spec/controllers/sessions_controller_spec.rb
@@ -34,8 +34,8 @@ describe SessionsController do
end
it "returns a valid session" do
- expect(cookies.signed[:cookie_monster]).to_not be_nil
- expect(cookies.signed[:cookie_monster]).to eql(user_session.key)
+ expect(cookies.signed[:raphael]).to_not be_nil
+ expect(cookies.signed[:raphael]).to eql(user_session.key)
end
it "redirects to the dashboard" do
@@ -58,12 +58,12 @@ describe SessionsController do
describe "#destroy" do
before :each do
- request.cookies[:cookie_monster] = SecureRandom.uuid
+ request.cookies[:raphael] = SecureRandom.uuid
delete :destroy, id: "me"
end
it "removes the cookie" do
- expect(cookies[:cookie_monster]).to be_nil
+ expect(cookies[:raphael]).to be_nil
end
it "redirects to the homepage" do