Add support for mkpath, an alias for mkdir_p on FileUtils

Signed-off-by: Chris Wanstrath <chris@ozmm.org>
This commit is contained in:
Rob Sanheim 2009-09-13 10:14:07 +08:00 committed by Chris Wanstrath
parent e8257feadd
commit bbb659fcf8
2 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,7 @@ module FakeFS
def mkdir_p(path)
FileSystem.add(path, FakeDir.new)
end
alias_method :mkpath, :mkdir_p
def rm(path)
FileSystem.delete(path)

View File

@ -26,6 +26,11 @@ class FakeFSTest < Test::Unit::TestCase
assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir']
end
def test_can_create_directories_with_mkpath
FileUtils.mkpath("/path/to/dir")
assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir']
end
def test_knows_directories_exist
FileUtils.mkdir_p(path = "/path/to/dir")
assert File.exists?(path)