Skip to content

Commit

Permalink
FileUtils#mkdir_p accepts options. Closes fakefs#41.
Browse files Browse the repository at this point in the history
  • Loading branch information
gcampbell authored and smtlaissezfaire committed Jul 3, 2010
1 parent 5099b3c commit 97a68c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fakefs/fileutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module FakeFS
module FileUtils
extend self

def mkdir_p(path)
def mkdir_p(path, options = {})
FileSystem.add(path, FakeDir.new)
end
alias_method :mkpath, :mkdir_p
Expand Down
10 changes: 10 additions & 0 deletions test/fakefs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,21 @@ def test_can_create_directories
assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir']
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
FileUtils.mkpath("/path/to/dir")
assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir']
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
FileUtils.mkdir_p("/path/to/dir")
FileUtils.rmdir("/path/to/dir")
Expand Down

0 comments on commit 97a68c0

Please sign in to comment.