aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/message_encryptor_test.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2012-10-30 16:41:11 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2012-11-03 14:57:53 -0200
commit38c40dbbc1de5837a05d762be95e69105acc929c (patch)
treedd766ccaaa368e262f1b241abbed988cb3f2ff8a /activesupport/test/message_encryptor_test.rb
parente272000c80548c3de9380bb6c76397d018fb1c68 (diff)
downloadrails-38c40dbbc1de5837a05d762be95e69105acc929c.tar.gz
rails-38c40dbbc1de5837a05d762be95e69105acc929c.tar.bz2
rails-38c40dbbc1de5837a05d762be95e69105acc929c.zip
Add cookie.encrypted which returns an EncryptedCookieJar
How to use it? cookies.encrypted[:discount] = 45 => Set-Cookie: discount=ZS9ZZ1R4cG1pcUJ1bm80anhQang3dz09LS1mbDZDSU5scGdOT3ltQ2dTdlhSdWpRPT0%3D--ab54663c9f4e3bc340c790d6d2b71e92f5b60315; path=/ cookies.encrypted[:discount] => 45
Diffstat (limited to 'activesupport/test/message_encryptor_test.rb')
-rw-r--r--activesupport/test/message_encryptor_test.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/test/message_encryptor_test.rb b/activesupport/test/message_encryptor_test.rb
index b544742300..d6c31396b6 100644
--- a/activesupport/test/message_encryptor_test.rb
+++ b/activesupport/test/message_encryptor_test.rb
@@ -56,7 +56,7 @@ class MessageEncryptorTest < ActiveSupport::TestCase
end
def test_alternative_serialization_method
- encryptor = ActiveSupport::MessageEncryptor.new(SecureRandom.hex(64), :serializer => JSONSerializer.new)
+ encryptor = ActiveSupport::MessageEncryptor.new(SecureRandom.hex(64), SecureRandom.hex(64), :serializer => JSONSerializer.new)
message = encryptor.encrypt_and_sign({ :foo => 123, 'bar' => Time.utc(2010) })
assert_equal encryptor.decrypt_and_verify(message), { "foo" => 123, "bar" => "2010-01-01T00:00:00Z" }
end