FileUtils#mkdir_p accepts options. Closes #41.

This commit is contained in:
Greg Campbell 2010-07-02 13:18:30 -07:00 committed by Scott Taylor
parent 5099b3cedb
commit 97a68c01ba
2 changed files with 11 additions and 1 deletions

View File

@ -2,7 +2,7 @@ module FakeFS
module FileUtils module FileUtils
extend self extend self
def mkdir_p(path) def mkdir_p(path, options = {})
FileSystem.add(path, FakeDir.new) FileSystem.add(path, FakeDir.new)
end end
alias_method :mkpath, :mkdir_p alias_method :mkpath, :mkdir_p

View File

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