don't overwrite existing directories yet
This commit is contained in:
parent
384d58e736
commit
d8aa9f38fc
@ -43,7 +43,7 @@ module FakeFS
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.exists?(path)
|
def self.exists?(path)
|
||||||
FileSystem.find(path)
|
FileSystem.find(path) || false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.directory?(path)
|
def self.directory?(path)
|
||||||
@ -152,7 +152,7 @@ module FakeFS
|
|||||||
|
|
||||||
object.name = parts.last
|
object.name = parts.last
|
||||||
object.parent = d
|
object.parent = d
|
||||||
d[parts.last] = object
|
d[parts.last] ||= object
|
||||||
end
|
end
|
||||||
|
|
||||||
# copies directories and files from the real filesystem
|
# copies directories and files from the real filesystem
|
||||||
|
@ -36,6 +36,13 @@ class FakeFSTest < Test::Unit::TestCase
|
|||||||
assert File.directory?(path)
|
assert File.directory?(path)
|
||||||
end
|
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
|
def test_can_create_symlinks
|
||||||
FileUtils.mkdir_p(target = "/path/to/target")
|
FileUtils.mkdir_p(target = "/path/to/target")
|
||||||
FileUtils.ln_s(target, "/path/to/link")
|
FileUtils.ln_s(target, "/path/to/link")
|
||||||
|
Loading…
Reference in New Issue
Block a user