diff --git a/lib/fakefs/fake/symlink.rb b/lib/fakefs/fake/symlink.rb index 5132542..750d095 100644 --- a/lib/fakefs/fake/symlink.rb +++ b/lib/fakefs/fake/symlink.rb @@ -1,6 +1,6 @@ module FakeFS class FakeSymlink - attr_accessor :name, :target + attr_accessor :name, :target, :parent alias_method :to_s, :name def initialize(target) diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index 53290c0..9d999f8 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -141,6 +141,12 @@ class FakeFSTest < Test::Unit::TestCase assert_equal target, File.readlink(link) end + def test_symlinks_in_different_directories + FileUtils.mkdir_p(target = "/path/to/foo/target") + FileUtils.ln_s(target, link = "/path/to/bar/symlink") + assert_equal target, File.readlink(link) + end + def test_knows_symlinks_are_symlinks FileUtils.mkdir_p(target = "/path/to/target") FileUtils.ln_s(target, link = "/path/to/symlink")