diff options
-rw-r--r-- | actionwebservice/lib/action_web_service/casting.rb | 1 | ||||
-rw-r--r-- | actionwebservice/test/casting_test.rb | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/actionwebservice/lib/action_web_service/casting.rb b/actionwebservice/lib/action_web_service/casting.rb index b30de2d4c4..91f36d113a 100644 --- a/actionwebservice/lib/action_web_service/casting.rb +++ b/actionwebservice/lib/action_web_service/casting.rb @@ -39,6 +39,7 @@ module ActionWebService # :nodoc: def cast(value, signature_type) # :nodoc: return value if signature_type.nil? # signature.length != params.length + return nil if value.nil? unless signature_type.array? || signature_type.structured? return value if canonical_type(value.class) == signature_type.type end diff --git a/actionwebservice/test/casting_test.rb b/actionwebservice/test/casting_test.rb index 223313564b..aa8941da17 100644 --- a/actionwebservice/test/casting_test.rb +++ b/actionwebservice/test/casting_test.rb @@ -62,8 +62,8 @@ class TC_Casting < Test::Unit::TestCase def test_array_type_casting assert_equal [1, 2, 3213992, 4], cast_expects(:int_array, ['1', '2', '3213992', '4'])[0] - assert_equal ['one', 'two', '5.0', '200', '', 'true'], cast_expects(:str_array, [:one, 'two', 5.0, 200, nil, true])[0] - assert_equal [true, false, true, true, false], cast_expects(:bool_array, ['1', nil, 'y', true, 'false'])[0] + assert_equal ['one', 'two', '5.0', '200', nil, 'true'], cast_expects(:str_array, [:one, 'two', 5.0, 200, nil, true])[0] + assert_equal [true, nil, true, true, false], cast_expects(:bool_array, ['1', nil, 'y', true, 'false'])[0] end def test_array_type_casting_failure |