summaryrefslogtreecommitdiff
path: root/test/xmlrpc/test_client.rb
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 /test/xmlrpc/test_client.rb
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
Diffstat (limited to 'test/xmlrpc/test_client.rb')
-rw-r--r--test/xmlrpc/test_client.rb34
1 files changed, 33 insertions, 1 deletions
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'