aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionwebservice/lib/action_web_service/test_invoke.rb1
-rw-r--r--actionwebservice/test/test_invoke_test.rb21
2 files changed, 22 insertions, 0 deletions
diff --git a/actionwebservice/lib/action_web_service/test_invoke.rb b/actionwebservice/lib/action_web_service/test_invoke.rb
index ee15070851..e4469851eb 100644
--- a/actionwebservice/lib/action_web_service/test_invoke.rb
+++ b/actionwebservice/lib/action_web_service/test_invoke.rb
@@ -52,6 +52,7 @@ module Test # :nodoc:
end
protocol.register_api(api)
method = api.api_methods[api_method_name.to_sym]
+ raise ArgumentError, "wrong number of arguments for rpc call (#{args.length} for #{method.expects.length})" unless args.length == method.expects.length
protocol.encode_request(public_method_name(service_name, api_method_name), args.dup, method.expects)
end
diff --git a/actionwebservice/test/test_invoke_test.rb b/actionwebservice/test/test_invoke_test.rb
index 611a0ac215..46f9ddb2d2 100644
--- a/actionwebservice/test/test_invoke_test.rb
+++ b/actionwebservice/test/test_invoke_test.rb
@@ -76,4 +76,25 @@ class TestInvokeTest < Test::Unit::TestCase
end
end
end
+
+ def test_layered_fail_with_wrong_number_of_arguments
+ [:soap, :xmlrpc].each do |protocol|
+ @protocol = protocol
+ [:one, :two].each do |service|
+ @controller = TestInvokeLayeredController.new
+ assert_raise(ArgumentError) { invoke_layered service, :add, 1 }
+ end
+ end
+ end
+
+ def test_delegated_fail_with_wrong_number_of_arguments
+ @controller = TestInvokeDelegatedController.new
+ assert_raise(ArgumentError) { invoke_delegated :service, :add, 1 }
+ end
+
+ def test_direct_fail_with_wrong_number_of_arguments
+ @controller = TestInvokeDirectController.new
+ assert_raise(ArgumentError) { invoke :add, 1 }
+ end
+
end