Unified · Split
| @@ -100,7 +100,7 @@ module Docs · 99 unmodified lines | |||
| 100 | result << '/' if result != '.' | 100 | result << '/' if result != '.' |
| 101 | end | 101 | end |
| 102 | else | 102 | else |
| 103 | dest_dir.parent.relative_path_from(base_dir).join(::File.basename(dest)).to_s | 103 | dest_dir.parent.relative_path_from(base_dir).join(dest.split('/').last).to_s |
| 104 | end | 104 | end |
| 105 | end | 105 | end |
| 106 | 106 | ||
| @@ -394,6 +394,14 @@ class DocsUrlTest < MiniTest::Spec · 393 unmodified lines | |||
| 394 | assert_equal 'file', url.relative_path_to('http://example.com/file?query#frag') | 394 | assert_equal 'file', url.relative_path_to('http://example.com/file?query#frag') |
| 395 | end | 395 | end |
| 396 | 396 | ||
| 397 | it "returns 'some:file' with 'http://example.com/some:file'" do | ||
| 398 | assert_equal 'some:file', url.relative_path_to('http://example.com/some:file') | ||
| 399 | end | ||
| 400 | |||
| 401 | it "returns 'some:file' with 'http://example.com/some:file?query#frag'" do | ||
| 402 | assert_equal 'some:file', url.relative_path_to('http://example.com/some:file?query#frag') | ||
| 403 | end | ||
| 404 | |||
| 397 | it "returns nil with '/file'" do | 405 | it "returns nil with '/file'" do |
| 398 | assert_nil url.relative_path_to('/file') | 406 | assert_nil url.relative_path_to('/file') |
| 399 | end | 407 | end |