Skip to content

Commit

Permalink
Fixed tests so that they will also run properly in other timezones.
Browse files Browse the repository at this point in the history
  • Loading branch information
wvanbergen committed Sep 15, 2011
1 parent bffaa88 commit a8aaef6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions activesupport/test/message_encryptor_test.rb
Expand Up @@ -44,8 +44,8 @@ def test_alternative_serialization_method
@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
Expand Down
4 changes: 2 additions & 2 deletions activesupport/test/message_verifier_test.rb
Expand Up @@ -37,8 +37,8 @@ def test_alternative_serialization_method
@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)
Expand Down

0 comments on commit a8aaef6

Please sign in to comment.