don't overwrite existing directories yet
This commit is contained in:
parent
384d58e736
commit
d8aa9f38fc
@ -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
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user