summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-07 13:45:04 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-07 13:45:04 +0000
commit0c8ae9165180e39c8a18e2172876eef83cd3eae9 (patch)
tree7c327119c94e5c946a659045f106fa7f6fdc4c00
parent075d98c7dc0cee294f03ed0ed26e1e8d8876b2b9 (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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 c73efc3f79..2dff3c1369 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 5c11d4f38b..54f721fd37 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 c3c3854d72..bf57d7e54c 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'