don't overwrite existing directories yet

This commit is contained in:
Chris Wanstrath 2009-05-29 11:00:44 -07:00
parent 384d58e736
commit d8aa9f38fc
2 changed files with 9 additions and 2 deletions

View File

@ -43,7 +43,7 @@ module FakeFS
end
def self.exists?(path)
FileSystem.find(path)
FileSystem.find(path) || false
end
def self.directory?(path)
@ -152,7 +152,7 @@ module FakeFS
object.name = parts.last
object.parent = d
d[parts.last] = object
d[parts.last] ||= object
end
# copies directories and files from the real filesystem

View File

@ -36,6 +36,13 @@ class FakeFSTest < Test::Unit::TestCase
assert File.directory?(path)
end
def test_doesnt_overwrite_existing_directories
FileUtils.mkdir_p(path = "/path/to/dir")
assert File.exists?(path)
FileUtils.mkdir_p("/path/to")
assert File.exists?(path)
end
def test_can_create_symlinks
FileUtils.mkdir_p(target = "/path/to/target")
FileUtils.ln_s(target, "/path/to/link")