summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-04-16 13:53:11 +0200
committergit <svn-admin@ruby-lang.org>2022-04-16 22:58:34 +0900
commite70e7f4ad38abb305342dd4d5a392782597d1f98 (patch)
tree21d87ee1ca789175144f57d7c456a8fcac3ca823
parent9a20bcd5c8b5e5114783febc5168506972b1c234 (diff)
[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
-rw-r--r--test/rubygems/test_gem_installer.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index c90fdab283..46bb6965c7 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -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