aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/message_verifier_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/message_verifier_test.rb')
-rw-r--r--activesupport/test/message_verifier_test.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/activesupport/test/message_verifier_test.rb b/activesupport/test/message_verifier_test.rb
index 668d78492e..d56a46b250 100644
--- a/activesupport/test/message_verifier_test.rb
+++ b/activesupport/test/message_verifier_test.rb
@@ -1,10 +1,9 @@
-require 'abstract_unit'
-require 'openssl'
-require 'active_support/time'
-require 'active_support/json'
+require "abstract_unit"
+require "openssl"
+require "active_support/time"
+require "active_support/json"
class MessageVerifierTest < ActiveSupport::TestCase
-
class JSONSerializer
def dump(value)
ActiveSupport::JSON.encode(value)
@@ -17,7 +16,7 @@ class MessageVerifierTest < ActiveSupport::TestCase
def setup
@verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!")
- @data = { :some => "data", :now => Time.local(2010) }
+ @data = { some: "data", now: Time.local(2010) }
end
def test_valid_message
@@ -49,8 +48,8 @@ class MessageVerifierTest < ActiveSupport::TestCase
def test_alternative_serialization_method
prev = ActiveSupport.use_standard_json_time_format
ActiveSupport.use_standard_json_time_format = true
- verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", :serializer => JSONSerializer.new)
- message = verifier.generate({ :foo => 123, 'bar' => Time.utc(2010) })
+ verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", serializer: JSONSerializer.new)
+ message = verifier.generate(:foo => 123, "bar" => Time.utc(2010))
exp = { "foo" => 123, "bar" => "2010-01-01T00:00:00.000Z" }
assert_equal exp, verifier.verified(message)
assert_equal exp, verifier.verify(message)
@@ -81,6 +80,6 @@ class MessageVerifierTest < ActiveSupport::TestCase
exception = assert_raise(ArgumentError) do
ActiveSupport::MessageVerifier.new(nil)
end
- assert_equal exception.message, 'Secret should not be nil.'
+ assert_equal exception.message, "Secret should not be nil."
end
end