From 12532c8e376872e9764176199d61066b5ea10e6a Mon Sep 17 00:00:00 2001 From: timo3377 Date: Tue, 19 Apr 2011 12:14:17 -0700 Subject: [PATCH] Alias mkdir_p + makedirs for compatability with Rails3. Closes #79 --- lib/fakefs/fileutils.rb | 1 + test/fakefs_test.rb | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/fakefs/fileutils.rb b/lib/fakefs/fileutils.rb index 4315feb..0b9536f 100644 --- a/lib/fakefs/fileutils.rb +++ b/lib/fakefs/fileutils.rb @@ -6,6 +6,7 @@ module FakeFS FileSystem.add(path, FakeDir.new) end alias_method :mkpath, :mkdir_p + alias_method :makedirs, :mkdir_p def mkdir(path) parent = path.split('/') diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index f041baf..49495b3 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -55,6 +55,16 @@ class FakeFSTest < Test::Unit::TestCase assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir'] end + def test_can_create_directories_with_mkpath + FileUtils.makedirs("/path/to/dir") + assert_kind_of FakeDir, FileSystem.fs['path']['to']['dir'] + end + + def test_can_create_directories_with_mkpath_and_options + FileUtils.makedirs("/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")