summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Sørensen <johan@johansorensen.com>2009-04-02 13:31:14 +0200
committerJohan Sørensen <johan@johansorensen.com>2009-04-22 15:18:18 +0200
commit0d3761f9c610702df946a6f2d49a181e1ebb3a5f (patch)
tree45c76a3aef96affb9fb5cad3312f011526a7ba29
parent84ba4b0f0b02cc014a243fa3bdf95feb688af7bd (diff)
downloadgitorious-mainline-outdated-0d3761f9c610702df946a6f2d49a181e1ebb3a5f.zip
gitorious-mainline-outdated-0d3761f9c610702df946a6f2d49a181e1ebb3a5f.tar.gz
gitorious-mainline-outdated-0d3761f9c610702df946a6f2d49a181e1ebb3a5f.tar.bz2
Test that the authenticated cookie gets deleted when logging out and set when
logging in via an auth_token
-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