ruby-changes:22896
From: nagachika <ko1@a...>
Date: Wed, 7 Mar 2012 22:45:16 +0900 (JST)
Subject: [ruby-changes:22896] nagachika:r34945 (trunk): * lib/xmlrpc/client.rb (module XMLRPC): fix typo.
nagachika 2012-03-07 22:45:04 +0900 (Wed, 07 Mar 2012) New Revision: 34945 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34945 Log: * lib/xmlrpc/client.rb (module XMLRPC): fix typo. * test/xmlrpc/test_client.rb (test_async_call): add test for XMLRPC::Client#call_async to check above fix. Modified files: trunk/ChangeLog trunk/lib/xmlrpc/client.rb trunk/test/xmlrpc/test_client.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 34944) +++ ChangeLog (revision 34945) @@ -1,3 +1,10 @@ +Wed Mar 7 22:41:50 2012 CHIKANAGA Tomoyuki <nagachika00@g...> + + * lib/xmlrpc/client.rb (module XMLRPC): fix typo. + + * test/xmlrpc/test_client.rb (test_async_call): add test for + XMLRPC::Client#call_async to check above fix. + Wed Mar 7 16:30:24 2012 Nobuyoshi Nakada <nobu@r...> * error.c (rb_load_fail): should honor encoding. Index: lib/xmlrpc/client.rb =================================================================== --- lib/xmlrpc/client.rb (revision 34944) +++ lib/xmlrpc/client.rb (revision 34945) @@ -526,7 +526,7 @@ if async # use a new HTTP object for each call - http = net_http.new(@host, @port, @proxy_host, @proxy_port) + http = net_http(@host, @port, @proxy_host, @proxy_port) http.use_ssl = @use_ssl if @use_ssl http.read_timeout = @timeout http.open_timeout = @timeout Index: test/xmlrpc/test_client.rb =================================================================== --- test/xmlrpc/test_client.rb (revision 34944) +++ test/xmlrpc/test_client.rb (revision 34945) @@ -16,7 +16,17 @@ def started? @started end - def start; @started = true; end + def start + @started = true + if block_given? + begin + return yield(self) + ensure + @started = false + end + end + self + end def request_post path, request, headers @responses[path].shift @@ -210,6 +220,28 @@ assert_equal expected, resp end + def test_async_request + fh = read 'blog.xml' + + responses = { + '/foo' => [ Fake::Response.new(fh, [['Content-Type', 'text/xml']]) ] + } + + client = fake_client(responses).new2 'http://example.org/foo' + + resp = client.call_async('wp.getUsersBlogs', 'tlo', 'omg') + + expected = [{ + "isAdmin" => true, + "url" => "http://tenderlovemaking.com/", + "blogid" => "1", + "blogName" => "Tender Lovemaking", + "xmlrpc" => "http://tenderlovemaking.com/xmlrpc.php" + }] + + assert_equal expected, resp + end + # make a request without content-type header def test_bad_content_type fh = read 'blog.xml' -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/