From c086dfbb99cbd49dadd51cc6b301125806684d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 19 May 2014 08:51:51 -0300 Subject: Make sure Bignum can be serialized --- test/cases/parameters_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/cases/parameters_test.rb b/test/cases/parameters_test.rb index 3fbdf8adee..fb0b920c6e 100644 --- a/test/cases/parameters_test.rb +++ b/test/cases/parameters_test.rb @@ -8,6 +8,16 @@ class ParameterSerializationTest < ActiveSupport::TestCase end test 'should not allow complex objects' do + assert_equal [ nil ], ActiveJob::Parameters.serialize([ nil ]) + assert_equal [ 1 ], ActiveJob::Parameters.serialize([ 1 ]) + assert_equal [ 1.0 ], ActiveJob::Parameters.serialize([ 1.0 ]) + assert_equal [ 'a' ], ActiveJob::Parameters.serialize([ 'a' ]) + assert_equal [ true ], ActiveJob::Parameters.serialize([ true ]) + assert_equal [ false ], ActiveJob::Parameters.serialize([ false ]) + assert_equal [ { a: 1 } ], ActiveJob::Parameters.serialize([ { a: 1 } ]) + assert_equal [ [ 1 ] ], ActiveJob::Parameters.serialize([ [ 1 ] ]) + assert_equal [ 1_000_000_000_000_000_000_000 ], ActiveJob::Parameters.serialize([ 1_000_000_000_000_000_000_000 ]) + err = assert_raises RuntimeError do ActiveJob::Parameters.serialize([ 1, self ]) end -- cgit v1.2.3