diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2018-02-17 00:15:11 +0200 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2018-02-17 17:48:10 +0200 |
commit | d2c094aa5081677bf537a1553d0a756fcafcfb4e (patch) | |
tree | cc68aaa6c2d4e42cbeeadb03584dd7cdf2b19272 /activejob/test | |
parent | a713fdae4eb4f7ccd34932edc61561a96b8d9f35 (diff) | |
download | rails-d2c094aa5081677bf537a1553d0a756fcafcfb4e.tar.gz rails-d2c094aa5081677bf537a1553d0a756fcafcfb4e.tar.bz2 rails-d2c094aa5081677bf537a1553d0a756fcafcfb4e.zip |
Add argument serializer `TimeWithZoneSerializer`
The serializer serializes an instance of `ActiveSupport::TimeWithZone`.
The serializer deserializes value to `ActiveSupport::TimeWithZone` if possible.
Diffstat (limited to 'activejob/test')
-rw-r--r-- | activejob/test/cases/argument_serialization_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activejob/test/cases/argument_serialization_test.rb b/activejob/test/cases/argument_serialization_test.rb index ff6ac6fc43..1daccd40c4 100644 --- a/activejob/test/cases/argument_serialization_test.rb +++ b/activejob/test/cases/argument_serialization_test.rb @@ -102,6 +102,14 @@ class ArgumentSerializationTest < ActiveSupport::TestCase assert_instance_of ActiveSupport::HashWithIndifferentAccess, perform_round_trip([indifferent_access]).first end + test "should maintain time with zone" do + Time.use_zone "Alaska" do + time_with_zone = Time.new(2002, 10, 31, 2, 2, 2).in_time_zone + assert_instance_of ActiveSupport::TimeWithZone, perform_round_trip([time_with_zone]).first + assert_arguments_unchanged time_with_zone + end + end + test "should disallow non-string/symbol hash keys" do assert_raises ActiveJob::SerializationError do ActiveJob::Arguments.serialize [ { 1 => 2 } ] |