提交 a8aaef67 编写于 作者: W Willem van Bergen

Fixed tests so that they will also run properly in other timezones.

上级 bffaa888
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册