From 1597e76c7f67edfd048a173b94f865e106883162 Mon Sep 17 00:00:00 2001 From: Jared Luxenberg Date: Wed, 23 Mar 2011 09:55:30 -0700 Subject: [PATCH] adding 'parent' attr_accessor to FakeFS::FakeSymlink (#69) --- lib/fakefs/fake/symlink.rb | 2 +- test/fakefs_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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")