summaryrefslogtreecommitdiff
path: root/test/xmlrpc/test_client.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-02 23:21:17 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-02 23:21:17 +0000
commitcd85cd25b4f129225d20d36fa5326e9e57901da0 (patch)
tree356d5a34318c303f173303ab1bb5382a15887e14 /test/xmlrpc/test_client.rb
parent60282ebfe5ddb283fc2312fb6a2ce9e928cb2ad9 (diff)
* lib/xmlrpc/client.rb (new2): raises an ArgumentError on bad
arguments. * test/xmlrpc/test_client.rb: tests for bad uris git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/xmlrpc/test_client.rb')
-rw-r--r--test/xmlrpc/test_client.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/xmlrpc/test_client.rb b/test/xmlrpc/test_client.rb
index e12391a3ea1..353bfc5f887 100644
--- a/test/xmlrpc/test_client.rb
+++ b/test/xmlrpc/test_client.rb
@@ -98,5 +98,39 @@ module XMLRPC
[ user, password, use_ssl, timeout ].each { |x| refute x }
end
+
+ def test_new2_no_path
+ client = FakeClient.new2 'http://example.org'
+ host, path, port, *rest = client.args
+
+ assert_equal 'example.org', host
+ assert_nil path
+ assert port
+
+ rest.each { |x| refute x }
+ end
+
+ def test_new2_slash_path
+ client = FakeClient.new2 'http://example.org/'
+ host, path, port, *rest = client.args
+
+ assert_equal 'example.org', host
+ assert_equal '/', path
+ assert port
+
+ rest.each { |x| refute x }
+ end
+
+ def test_new2_bad_protocol
+ assert_raises(ArgumentError) do
+ XMLRPC::Client.new2 'ftp://example.org'
+ end
+ end
+
+ def test_new2_bad_uri
+ assert_raises(ArgumentError) do
+ XMLRPC::Client.new2 ':::::'
+ end
+ end
end
end