diff options
author | Willem van Bergen <willem@vanbergen.org> | 2011-09-15 15:51:30 -0400 |
---|---|---|
committer | Willem van Bergen <willem@vanbergen.org> | 2011-09-15 15:51:30 -0400 |
commit | 6d520803ee005d47c876662ba426083e823199ed (patch) | |
tree | 9ac563affb6d71dc06943ddf296462afe41761d3 /activesupport | |
parent | 41fea0334232824d5d509a6924e8c8487d53494b (diff) | |
download | rails-6d520803ee005d47c876662ba426083e823199ed.tar.gz rails-6d520803ee005d47c876662ba426083e823199ed.tar.bz2 rails-6d520803ee005d47c876662ba426083e823199ed.zip |
Test deprecation warning when not using an options hash as second parameter.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/test/message_encryptor_test.rb | 8 | ||||
-rw-r--r-- | activesupport/test/message_verifier_test.rb | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/activesupport/test/message_encryptor_test.rb b/activesupport/test/message_encryptor_test.rb index 58f94a7400..83a19f8106 100644 --- a/activesupport/test/message_encryptor_test.rb +++ b/activesupport/test/message_encryptor_test.rb @@ -10,7 +10,7 @@ else require 'active_support/time' require 'active_support/json' -class MessageEncryptorTest < Test::Unit::TestCase +class MessageEncryptorTest < ActiveSupport::TestCase class JSONSerializer def dump(value) @@ -57,6 +57,12 @@ class MessageEncryptorTest < Test::Unit::TestCase assert_equal encryptor.decrypt_and_verify(message), { "foo" => 123, "bar" => "2010-01-01T00:00:00Z" } end + def test_digest_algorithm_as_second_parameter_deprecation + assert_deprecated(/options hash/) do + ActiveSupport::MessageEncryptor.new(SecureRandom.hex(64), 'aes-256-cbc') + end + end + private def assert_not_decrypted(value) assert_raise(ActiveSupport::MessageEncryptor::InvalidMessage) do diff --git a/activesupport/test/message_verifier_test.rb b/activesupport/test/message_verifier_test.rb index 3dc047c126..35747abe5b 100644 --- a/activesupport/test/message_verifier_test.rb +++ b/activesupport/test/message_verifier_test.rb @@ -10,7 +10,7 @@ else require 'active_support/time' require 'active_support/json' -class MessageVerifierTest < Test::Unit::TestCase +class MessageVerifierTest < ActiveSupport::TestCase class JSONSerializer def dump(value) @@ -49,6 +49,12 @@ class MessageVerifierTest < Test::Unit::TestCase message = verifier.generate({ :foo => 123, 'bar' => Time.utc(2010) }) assert_equal verifier.verify(message), { "foo" => 123, "bar" => "2010-01-01T00:00:00Z" } end + + def test_digest_algorithm_as_second_parameter_deprecation + assert_deprecated(/options hash/) do + ActiveSupport::MessageVerifier.new("secret", "SHA1") + end + end def assert_not_verified(message) assert_raise(ActiveSupport::MessageVerifier::InvalidSignature) do |