1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Fix test issues surfaced using a stricter behavior of FileUtils

We were trying to remove directories using `FileUtils.rm_f` which is
unexpected and does not remove anything. Changing to `FileUtils.rm_rf`
actually removes the directories properly. That itself showed other
issues:

* One test was actually removing the gem package it was about to
  install, since it was living in the cache folder. To fix that, avoid
  removing the cache folder, and only make sure the other directories
  are created automatically, which seems enough.

* Another test was actually removing an incorrect directory. Change it
  to remove the right one (the one that's asserted later to have been
  created).

https://github.com/rubygems/rubygems/commit/5538e7ff20
This commit is contained in:
David Rodríguez 2022-04-16 13:53:11 +02:00 committed by git
parent 9a20bcd5c8
commit e70e7f4ad3

View file

@ -1221,15 +1221,13 @@ gem 'other', version
def test_install_missing_dirs
installer = setup_base_installer
FileUtils.rm_f File.join(Gem.dir, 'cache')
FileUtils.rm_f File.join(Gem.dir, 'doc')
FileUtils.rm_f File.join(Gem.dir, 'specifications')
FileUtils.rm_rf File.join(Gem.dir, 'doc')
FileUtils.rm_rf File.join(Gem.dir, 'specifications')
use_ui @ui do
installer.install
end
assert_directory_exists File.join(Gem.dir, 'cache')
assert_directory_exists File.join(Gem.dir, 'doc')
assert_directory_exists File.join(Gem.dir, 'specifications')
@ -2237,7 +2235,7 @@ gem 'other', version
def test_default_gem_without_wrappers
installer = setup_base_installer
FileUtils.rm_f File.join(Gem.dir, 'specifications')
FileUtils.rm_rf File.join(Gem.default_dir, 'specifications')
installer.wrappers = false
installer.options[:install_as_default] = true