diff --git a/lib/fakefs/fileutils.rb b/lib/fakefs/fileutils.rb index d9c182c..a322331 100644 --- a/lib/fakefs/fileutils.rb +++ b/lib/fakefs/fileutils.rb @@ -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) diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index 26747b7..2d8de32 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -25,6 +25,11 @@ class FakeFSTest < Test::Unit::TestCase FileUtils.mkdir_p("/path/to/dir") 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")