Permalink
Browse files

Add more cookie tests

  • Loading branch information...
1 parent fa46aa1 commit 52a4346d8734719eaedca9c0a9430fded655b2ff @fxposter committed Nov 22, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 actionpack/test/dispatch/cookies_test.rb
@@ -109,6 +109,12 @@ def clear_encrypted_cookie
head :ok
end
+ def delete_and_set_signed_permanent_encrypted_cookie
+ cookies.signed.permanent.encrypted.delete :user_name
+ cookies.signed.permanent.encrypted[:user_surname] = 'Smith'
+ head :ok
+ end
+
def set_cookie_with_domain
cookies[:user_name] = {:value => "rizwanreza", :domain => :all}
head :ok
@@ -370,6 +376,14 @@ def test_clear_encrypted_cookie
assert @controller.send(:cookies).encrypted.deleted?(:user_name)
end
+ def test_delete_and_set_signed_permanent_encrypted_cookie
+ @controller.send(:cookies).signed.permanent.encrypted[:user_name] = 'Joe'
+ get :delete_and_set_signed_permanent_encrypted_cookie
+ assert_nil @controller.send(:cookies)[:user_name]
+ assert_nil @controller.send(:cookies).signed.permanent.encrypted[:user_name]
+ assert_equal @controller.send(:cookies).signed.permanent.encrypted[:user_surname], 'Smith'
+ end
+
def test_delete_and_set_cookie
request.cookies[:user_name] = 'Joe'
get :delete_and_set_cookie

0 comments on commit 52a4346

Please sign in to comment.