diff --git a/lib/fakefs/fileutils.rb b/lib/fakefs/fileutils.rb index b1532b5..d991f65 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 rmdir(list, options = {}) list = [ list ] unless list.is_a?(Array) diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index ad01eb7..20550c7 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -24,6 +24,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_can_delete_directories FileUtils.mkdir_p("/path/to/dir")