From bbb659fcf87faf1a56ce4ed4db2ed5a133fd2f1e Mon Sep 17 00:00:00 2001 From: Rob Sanheim Date: Sun, 13 Sep 2009 10:14:07 +0800 Subject: [PATCH] Add support for mkpath, an alias for mkdir_p on FileUtils Signed-off-by: Chris Wanstrath --- lib/fakefs/fileutils.rb | 1 + test/fakefs_test.rb | 5 +++++ 2 files changed, 6 insertions(+) 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")