diff --git a/lib/fakefs/dir.rb b/lib/fakefs/dir.rb index c56e395..2944894 100644 --- a/lib/fakefs/dir.rb +++ b/lib/fakefs/dir.rb @@ -108,7 +108,7 @@ module FakeFS class << self alias_method :getwd, :pwd alias_method :rmdir, :delete - alias_method :unline, :delete + alias_method :unlink, :delete end end end diff --git a/lib/fakefs/fileutils.rb b/lib/fakefs/fileutils.rb index 8ae66de..fd75a20 100644 --- a/lib/fakefs/fileutils.rb +++ b/lib/fakefs/fileutils.rb @@ -9,7 +9,11 @@ module FakeFS def rmdir(list, options = {}) list = [ list ] unless list.is_a?(Array) list.each do |l| + parent = l.split('/') + parent.pop + raise Errno::ENOENT, "No such file or directory - #{l}" unless parent.join == "" || FileSystem.find(parent.join('/')) raise Errno::ENOENT, l unless FileSystem.find(l) + raise Errno::ENOTEMPTY, l unless FileSystem.find(l).values.empty? rm(l) end end @@ -17,6 +21,7 @@ module FakeFS def rm(path) FileSystem.delete(path) end + alias_method :rm_rf, :rm alias_method :rm_r, :rm