FileUtils.rm should be able to delete two or more files. Closes #23
This commit is contained in:
parent
ea5705d560
commit
9212ba104a
@ -19,9 +19,11 @@ module FakeFS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def rm(path)
|
def rm(list, options = {})
|
||||||
|
Array(list).each do |path|
|
||||||
FileSystem.delete(path)
|
FileSystem.delete(path)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
alias_method :rm_rf, :rm
|
alias_method :rm_rf, :rm
|
||||||
alias_method :rm_r, :rm
|
alias_method :rm_r, :rm
|
||||||
|
@ -37,6 +37,13 @@ class FakeFSTest < Test::Unit::TestCase
|
|||||||
assert File.exists?("/path/to/dir") == false
|
assert File.exists?("/path/to/dir") == false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_can_delete_multiple_files
|
||||||
|
FileUtils.touch(["foo", "bar"])
|
||||||
|
FileUtils.rm(["foo", "bar"])
|
||||||
|
assert File.exists?("foo") == false
|
||||||
|
assert File.exists?("bar") == false
|
||||||
|
end
|
||||||
|
|
||||||
def test_knows_directories_exist
|
def test_knows_directories_exist
|
||||||
FileUtils.mkdir_p(path = "/path/to/dir")
|
FileUtils.mkdir_p(path = "/path/to/dir")
|
||||||
assert File.exists?(path)
|
assert File.exists?(path)
|
||||||
|
Loading…
Reference in New Issue
Block a user