simonc / memfs

MemFs provides a fake file system that can be used for tests. Strongly inspired by FakeFS.
MIT License
322 stars 27 forks source link

Errno::ENOTEMPTY with ruby 2.5.0 #27

Closed sbadia closed 6 years ago

sbadia commented 6 years ago

Hi!

Ruby 2.5.0 was released on decembre 2017 : https://www.ruby-lang.org/en/news/2017/12/25/ruby-2-5-0-released/ 🎅 🎄

In Debian, we started the transition to ruby 2.5 (as the default Ruby interpreter), but with this version of Ruby (2.5.0), your package didn't pass rspec tests.

Thanks in advance!

Failures:

  1) FileUtils.rmdir when a directory is not empty ignores errors
     Failure/Error: expect { described_class.rmdir('/test-dir') }.not_to raise_error

       expected no Exception, got #<Errno::ENOTEMPTY: Directory not empty - /test-dir> with backtrace:
         # ./lib/memfs/file_system.rb:121:in `rmdir'
         # ./lib/memfs/dir.rb:89:in `rmdir'
         # ./spec/fileutils_spec.rb:951:in `block (5 levels) in <top (required)>'
         # ./spec/fileutils_spec.rb:951:in `block (4 levels) in <top (required)>'
     # ./spec/fileutils_spec.rb:951:in `block (4 levels) in <top (required)>'

  2) FileUtils.rmdir when a directory is not empty doesn't remove the directory
     Failure/Error: fail Errno::ENOTEMPTY, path unless directory.empty?

     Errno::ENOTEMPTY:
       Directory not empty - /test-dir
     # ./lib/memfs/file_system.rb:121:in `rmdir'
     # ./lib/memfs/dir.rb:89:in `rmdir'
     # ./spec/fileutils_spec.rb:955:in `block (4 levels) in <top (required)>'

Finished in 0.37884 seconds (files took 0.38063 seconds to load)
812 examples, 2 failures, 2 pending

Failed examples:

rspec ./spec/fileutils_spec.rb:950 # FileUtils.rmdir when a directory is not empty ignores errors
rspec ./spec/fileutils_spec.rb:954 # FileUtils.rmdir when a directory is not empty doesn't remove the directory
simonc commented 6 years ago

@sbadia Hi. Thanks for reporting this! I fixed the specs to test for different behavior according to the current Ruby version.

sbadia commented 6 years ago

@simonc thanks !