From e360ac12315ed6b9eadca5bcc0d95dc766ba8523 Mon Sep 17 00:00:00 2001 From: Evgenii Pecherkin Date: Tue, 17 Oct 2017 16:05:05 +0400 Subject: Introduce serializers to ActiveJob --- activejob/test/cases/argument_serialization_test.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'activejob/test/cases/argument_serialization_test.rb') diff --git a/activejob/test/cases/argument_serialization_test.rb b/activejob/test/cases/argument_serialization_test.rb index 7e7f854da0..20296038a0 100644 --- a/activejob/test/cases/argument_serialization_test.rb +++ b/activejob/test/cases/argument_serialization_test.rb @@ -4,6 +4,7 @@ require "helper" require "active_job/arguments" require "models/person" require "active_support/core_ext/hash/indifferent_access" +require "active_support/duration" require "jobs/kwargs_job" class ArgumentSerializationTest < ActiveSupport::TestCase @@ -12,7 +13,8 @@ class ArgumentSerializationTest < ActiveSupport::TestCase end [ nil, 1, 1.0, 1_000_000_000_000_000_000_000, - "a", true, false, BigDecimal(5), + "a", true, false, BigDecimal.new(5), + :a, self, 1.day, [ 1, "a" ], { "a" => 1 } ].each do |arg| @@ -21,7 +23,7 @@ class ArgumentSerializationTest < ActiveSupport::TestCase end end - [ :a, Object.new, self, Person.find("5").to_gid ].each do |arg| + [ Object.new, Person.find("5").to_gid ].each do |arg| test "does not serialize #{arg.class}" do assert_raises ActiveJob::SerializationError do ActiveJob::Arguments.serialize [ arg ] @@ -33,6 +35,10 @@ class ArgumentSerializationTest < ActiveSupport::TestCase end end + test "serializes Struct" do + assert_arguments_unchanged Struct.new("Rectangle", :width, :height).new(10, 15) + end + test "should convert records to Global IDs" do assert_arguments_roundtrip [@person] end -- cgit v1.2.3