summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/getoptlong.rb2
-rw-r--r--lib/uri/.document7
-rw-r--r--test/uri/test_ftp.rb22
3 files changed, 29 insertions, 2 deletions
diff --git a/lib/getoptlong.rb b/lib/getoptlong.rb
index 6e23cb6c7f..8fb302d741 100644
--- a/lib/getoptlong.rb
+++ b/lib/getoptlong.rb
@@ -113,7 +113,7 @@ class GetoptLong
# argument ordering must be a member of ORDERINGS, i.e one of
# GetoptLong::REQUIRE_ORDER, GetoptLong::PERMUTE,
# GetoptLong::RETURN_IN_ORDER. A RuntimeError is raised if
- # option processin has already started.
+ # option processing has already started.
#
def ordering=(ordering)
#
diff --git a/lib/uri/.document b/lib/uri/.document
new file mode 100644
index 0000000000..214dd2e48f
--- /dev/null
+++ b/lib/uri/.document
@@ -0,0 +1,7 @@
+common.rb
+ftp.rb
+generic.rb
+http.rb
+https.rb
+ldap.rb
+mailto.rb
diff --git a/test/uri/test_ftp.rb b/test/uri/test_ftp.rb
index a7b59efebf..c27cf6165b 100644
--- a/test/uri/test_ftp.rb
+++ b/test/uri/test_ftp.rb
@@ -15,7 +15,7 @@ class TestFTP < Test::Unit::TestCase
exp = [
'ftp',
'user:pass', 'host.com', URI::FTP.default_port,
- '/abc/def', nil,
+ 'abc/def', nil,
]
ary = [
url.scheme, url.userinfo, url.host, url.port,
@@ -27,6 +27,26 @@ class TestFTP < Test::Unit::TestCase
assert_equal('pass', url.password)
end
+ def test_paths
+ # If you think what's below is wrong, please read RubyForge bug 2055,
+ # RFC 1738 section 3.2.2, and RFC 2396.
+ u = URI.parse('ftp://ftp.example.com/foo/bar/file.ext')
+ assert(u.path == 'foo/bar/file.ext')
+ u = URI.parse('ftp://ftp.example.com//foo/bar/file.ext')
+ assert(u.path == '/foo/bar/file.ext')
+ u = URI.parse('ftp://ftp.example.com/%2Ffoo/bar/file.ext')
+ assert(u.path == '/foo/bar/file.ext')
+ end
+
+ def test_assemble
+ # uri/ftp is conservative and uses the older RFC 1738 rules, rather than
+ # assuming everyone else has implemented RFC 2396.
+ uri = URI::FTP.build(['user:password', 'ftp.example.com', nil,
+ '/path/file.zip', 'i'])
+ assert(uri.to_s ==
+ 'ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=i')
+ end
+
def test_select
assert_equal(['ftp', 'a.b.c', 21], URI.parse('ftp://a.b.c/').select(:scheme, :host, :port))
u = URI.parse('ftp://a.b.c/')