adding 'parent' attr_accessor to FakeFS::FakeSymlink (#69)

This commit is contained in:
Jared Luxenberg 2011-03-23 09:55:30 -07:00 committed by Scott Taylor
parent 8b0d10b94b
commit 1597e76c7f
2 changed files with 7 additions and 1 deletions

View File

@ -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)

View File

@ -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")