From d4b27a0b36109c6ded5dba57db63d4ff12ec74d1 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 17 Mar 2006 22:20:09 +0000 Subject: Fix soap type registration of multidimensional arrays (closes #4232) [Kent] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3903 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionwebservice/test/abstract_client.rb | 9 +++++++++ actionwebservice/test/abstract_unit.rb | 7 +++++++ actionwebservice/test/client_soap_test.rb | 7 +++++++ actionwebservice/test/client_xmlrpc_test.rb | 7 +++++++ 4 files changed, 30 insertions(+) (limited to 'actionwebservice/test') diff --git a/actionwebservice/test/abstract_client.rb b/actionwebservice/test/abstract_client.rb index c5484b6b62..5207d8ef21 100644 --- a/actionwebservice/test/abstract_client.rb +++ b/actionwebservice/test/abstract_client.rb @@ -34,6 +34,10 @@ module ClientTest member :user, User member :users, [User] end + + class WithMultiDimArray < ActionWebService::Struct + member :pref, [[:string]] + end class API < ActionWebService::API::Base api_method :void @@ -48,6 +52,7 @@ module ClientTest api_method :user_return, :returns => [User] api_method :with_model_return, :returns => [WithModel] api_method :scoped_model_return, :returns => [Accounting::User] + api_method :multi_dim_return, :returns => [WithMultiDimArray] end class NullLogOut @@ -124,6 +129,10 @@ module ClientTest def scoped_model_return Accounting::User.find(1) end + + def multi_dim_return + WithMultiDimArray.new :pref => [%w{pref1 value1}, %w{pref2 value2}] + end end class AbstractClientLet < WEBrick::HTTPServlet::AbstractServlet diff --git a/actionwebservice/test/abstract_unit.rb b/actionwebservice/test/abstract_unit.rb index 149f108c98..6862d222e4 100644 --- a/actionwebservice/test/abstract_unit.rb +++ b/actionwebservice/test/abstract_unit.rb @@ -29,3 +29,10 @@ ActiveRecord::Base.establish_connection( ActiveRecord::Base.connection Test::Unit::TestCase.fixture_path = "#{File.dirname(__FILE__)}/fixtures/" + +# restore default raw_post functionality +class ActionController::TestRequest + def raw_post + super + end +end \ No newline at end of file diff --git a/actionwebservice/test/client_soap_test.rb b/actionwebservice/test/client_soap_test.rb index ee02d919a4..c03c24141f 100644 --- a/actionwebservice/test/client_soap_test.rb +++ b/actionwebservice/test/client_soap_test.rb @@ -142,4 +142,11 @@ class TC_ClientSoap < Test::Unit::TestCase assert_kind_of Accounting::User, scoped_model assert_equal 'Kent', scoped_model.name end + + def test_multi_dim_return + md_struct = @client.multi_dim_return + assert_kind_of Array, md_struct.pref + assert_equal 2, md_struct.pref.size + assert_kind_of Array, md_struct.pref[0] + end end diff --git a/actionwebservice/test/client_xmlrpc_test.rb b/actionwebservice/test/client_xmlrpc_test.rb index 8bb0fdffdc..0abd5898d8 100644 --- a/actionwebservice/test/client_xmlrpc_test.rb +++ b/actionwebservice/test/client_xmlrpc_test.rb @@ -141,4 +141,11 @@ class TC_ClientXmlRpc < Test::Unit::TestCase assert_kind_of Accounting::User, scoped_model assert_equal 'Kent', scoped_model.name end + + def test_multi_dim_return + md_struct = @client.multi_dim_return + assert_kind_of Array, md_struct.pref + assert_equal 2, md_struct.pref.size + assert_kind_of Array, md_struct.pref[0] + end end -- cgit v1.2.3