Alias mkdir_p + makedirs for compatability with Rails3. Closes #79

This commit is contained in:
timo3377 2011-04-19 12:14:17 -07:00 committed by Scott Taylor
parent fa2cacf2c3
commit 12532c8e37
2 changed files with 11 additions and 0 deletions

View File

@ -6,6 +6,7 @@ module FakeFS
FileSystem.add(path, FakeDir.new)
end
alias_method :mkpath, :mkdir_p
alias_method :makedirs, :mkdir_p
def mkdir(path)
parent = path.split('/')

View File

@ -55,6 +55,16 @@ class FakeFSTest < Test::Unit::TestCase
assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir']
end
def test_can_create_directories_with_mkpath
FileUtils.makedirs("/path/to/dir")
assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir']
end
def test_can_create_directories_with_mkpath_and_options
FileUtils.makedirs("/path/to/dir", :mode => 0755)
assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir']
end
def test_can_delete_directories
FileUtils.mkdir_p("/path/to/dir")
FileUtils.rmdir("/path/to/dir")