summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/functional/sessions_controller_test.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb
index 4b91f9f..499c084 100644
--- a/test/functional/sessions_controller_test.rb
+++ b/test/functional/sessions_controller_test.rb
@@ -159,7 +159,7 @@ class SessionsControllerTest < ActionController::TestCase
context 'Bypassing cachíng for authenticated users' do
should 'be set when logging in' do
post :create, :email => "johan@johansorensen.com", :password => "test"
- assert_not_nil cookies['authenticated']
+ assert_equal "true", cookies['authenticated']
end
should 'be removed when logging out' do
@@ -168,5 +168,19 @@ class SessionsControllerTest < ActionController::TestCase
delete :destroy
assert_nil cookies['authenticated']
end
+
+ should "remove the cookie when logging out" do
+ @request.cookies["authenticated"] = "true"
+ delete :destroy
+ assert_nil @response.cookies["authenticated"]
+ end
+
+ should "set the authenticated cookie when logging in with an auth token" do
+ users(:johan).remember_me
+ @request.cookies["auth_token"] = cookie_for(:johan)
+ get :new
+ assert @controller.send(:logged_in?)
+ assert_equal "true", @response.cookies["authenticated"]
+ end
end
end