fixing FakeFS::FakeSymLink#to_s (Closes #69)
This commit is contained in:
parent
1597e76c7f
commit
d98a06473e
@ -1,7 +1,6 @@
|
||||
module FakeFS
|
||||
class FakeSymlink
|
||||
attr_accessor :name, :target, :parent
|
||||
alias_method :to_s, :name
|
||||
|
||||
def initialize(target)
|
||||
@target = target
|
||||
@ -19,6 +18,10 @@ module FakeFS
|
||||
parent.delete(self)
|
||||
end
|
||||
|
||||
def to_s
|
||||
File.join(parent.to_s, name)
|
||||
end
|
||||
|
||||
def respond_to?(method)
|
||||
entry.respond_to?(method)
|
||||
end
|
||||
|
@ -147,6 +147,13 @@ class FakeFSTest < Test::Unit::TestCase
|
||||
assert_equal target, File.readlink(link)
|
||||
end
|
||||
|
||||
def test_symlinks_to_symlinks
|
||||
FileUtils.mkdir_p(target = "/path/to/foo/target")
|
||||
FileUtils.ln_s(target, link1 = "/path/to/bar/symlink")
|
||||
FileUtils.ln_s(link1, link2 = "/path/to/bar2/symlink")
|
||||
assert_equal link1, File.readlink(link2)
|
||||
end
|
||||
|
||||
def test_knows_symlinks_are_symlinks
|
||||
FileUtils.mkdir_p(target = "/path/to/target")
|
||||
FileUtils.ln_s(target, link = "/path/to/symlink")
|
||||
|
Loading…
Reference in New Issue
Block a user