summaryrefslogtreecommitdiff
path: root/test/pathname/test_pathname.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/pathname/test_pathname.rb')
-rw-r--r--test/pathname/test_pathname.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index 3bea182ed4..fbf4bb3459 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -1429,4 +1429,18 @@ class TestPathname < Test::Unit::TestCase
assert_instance_of(Pathname, foo.relative_path_from(bar))
end;
end
+
+ def test_relative_path_from_mock
+ assert_equal(
+ Pathname.new("../bar"),
+ Pathname.new("/foo/bar").relative_path_from(Pathname.new("/foo/baz")))
+ assert_equal(
+ Pathname.new("../bar"),
+ Pathname.new("/foo/bar").relative_path_from("/foo/baz"))
+ obj = Object.new
+ def obj.cleanpath() Pathname.new("/foo/baz") end
+ assert_equal(
+ Pathname.new("../bar"),
+ Pathname.new("/foo/bar").relative_path_from(obj))
+ end
end