summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--lib/xmlrpc/client.rb2
-rw-r--r--test/xmlrpc/test_client.rb34
3 files changed, 41 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c73efc3f79d..2dff3c13698 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Mar 7 22:41:50 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * 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@ruby-lang.org>
* error.c (rb_load_fail): should honor encoding.
diff --git a/lib/xmlrpc/client.rb b/lib/xmlrpc/client.rb
index 5c11d4f38b6..54f721fd37e 100644
--- a/lib/xmlrpc/client.rb
+++ b/lib/xmlrpc/client.rb
@@ -526,7 +526,7 @@ module XMLRPC
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
diff --git a/test/xmlrpc/test_client.rb b/test/xmlrpc/test_client.rb
index c3c3854d721..bf57d7e54cb 100644
--- a/test/xmlrpc/test_client.rb
+++ b/test/xmlrpc/test_client.rb
@@ -16,7 +16,17 @@ module XMLRPC
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 @@ module XMLRPC
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'