aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2014-08-08 18:05:53 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2014-08-08 18:05:53 -0300
commit705977620539e2be6548027042f33175ebdc2505 (patch)
tree642b0153673f187bfd1ba20b230f913ad2adaec5 /actionpack/test/dispatch
parentdde91e9bf5ab246f0f684b40288b272f4ba9a699 (diff)
parent629f4e007c1e80b931ed3d3a2553ad26997d8345 (diff)
downloadrails-705977620539e2be6548027042f33175ebdc2505.tar.gz
rails-705977620539e2be6548027042f33175ebdc2505.tar.bz2
rails-705977620539e2be6548027042f33175ebdc2505.zip
Merge pull request #16434 from strzalek/cookies-digest-config-option
Add digest config option for SignedCookiesJar
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r--actionpack/test/dispatch/cookies_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/cookies_test.rb b/actionpack/test/dispatch/cookies_test.rb
index 0f145666d1..744143fc2c 100644
--- a/actionpack/test/dispatch/cookies_test.rb
+++ b/actionpack/test/dispatch/cookies_test.rb
@@ -369,6 +369,23 @@ class CookiesTest < ActionController::TestCase
assert_equal 'Jamie', @controller.send(:cookies).permanent[:user_name]
end
+ def test_signed_cookie_using_default_digest
+ get :set_signed_cookie
+ cookies = @controller.send :cookies
+ assert_not_equal 45, cookies[:user_id]
+ assert_equal 45, cookies.signed[:user_id]
+ assert_equal 'SHA1', cookies.signed.instance_variable_get(:"@verifier").instance_variable_get(:"@digest")
+ end
+
+ def test_signed_cookie_using_custom_digest
+ @request.env["action_dispatch.cookies_digest"] = 'SHA256'
+ get :set_signed_cookie
+ cookies = @controller.send :cookies
+ assert_not_equal 45, cookies[:user_id]
+ assert_equal 45, cookies.signed[:user_id]
+ assert_equal 'SHA256', cookies.signed.instance_variable_get(:"@verifier").instance_variable_get(:"@digest")
+ end
+
def test_signed_cookie_using_default_serializer
get :set_signed_cookie
cookies = @controller.send :cookies