mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixed tests so that they will also run properly in other timezones.
This commit is contained in:
parent
bffaa888ac
commit
a8aaef6762
2 changed files with 4 additions and 4 deletions
|
@ -44,8 +44,8 @@ class MessageEncryptorTest < Test::Unit::TestCase
|
|||
@encryptor.serializer = lambda { |value| ActiveSupport::JSON.encode(value) }
|
||||
@encryptor.deserializer = lambda { |value| ActiveSupport::JSON.decode(value) }
|
||||
|
||||
message = @encryptor.encrypt_and_sign({ :foo => 123, 'bar' => Time.local(2010) })
|
||||
assert_equal @encryptor.decrypt_and_verify(message), { "foo" => 123, "bar" => "2010-01-01T00:00:00-05:00" }
|
||||
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
|
||||
|
||||
private
|
||||
|
|
|
@ -37,8 +37,8 @@ class MessageVerifierTest < Test::Unit::TestCase
|
|||
@verifier.serializer = lambda { |value| ActiveSupport::JSON.encode(value) }
|
||||
@verifier.deserializer = lambda { |value| ActiveSupport::JSON.decode(value) }
|
||||
|
||||
message = @verifier.generate({ :foo => 123, 'bar' => Time.local(2010) })
|
||||
assert_equal @verifier.verify(message), { "foo" => 123, "bar" => "2010-01-01T00:00:00-05:00" }
|
||||
message = @verifier.generate({ :foo => 123, 'bar' => Time.utc(2010) })
|
||||
assert_equal @verifier.verify(message), { "foo" => 123, "bar" => "2010-01-01T00:00:00Z" }
|
||||
end
|
||||
|
||||
def assert_not_verified(message)
|
||||
|
|
Loading…
Reference in a new issue