aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-02 20:16:39 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-04 22:56:48 -0200
commitd16e22478d65774431486e63a89bf6d01c00e5eb (patch)
tree8e94a601532e59ab76464360888adb58bbeb4714 /railties
parent05a011bd6bb003628c74cd37e02859d0c0f38c97 (diff)
downloadrails-d16e22478d65774431486e63a89bf6d01c00e5eb.tar.gz
rails-d16e22478d65774431486e63a89bf6d01c00e5eb.tar.bz2
rails-d16e22478d65774431486e63a89bf6d01c00e5eb.zip
Test if two different verifiers don't share the same secret
Diffstat (limited to 'railties')
-rw-r--r--railties/test/application/configuration_test.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 0ffe8a87a8..585d52d258 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -289,8 +289,18 @@ module ApplicationTests
app.config.session_store :disabled
end
- assert_equal Rails.application.message_verifier.object_id, Rails.application.message_verifier.object_id
- assert_not_equal Rails.application.message_verifier.object_id, Rails.application.message_verifier('text').object_id
+ default_verifier = app.message_verifier
+ text_verifier = app.message_verifier('text')
+
+ message = text_verifier.generate('some_value')
+
+ assert_equal 'some_value', text_verifier.verify(message)
+ assert_raises ActiveSupport::MessageVerifier::InvalidSignature do
+ default_verifier.verify(message)
+ end
+
+ assert_equal default_verifier.object_id, app.message_verifier.object_id
+ assert_not_equal default_verifier.object_id, text_verifier.object_id
end
test "protect from forgery is the default in a new app" do