aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-07-16 12:09:54 +0200
committergit <svn-admin@ruby-lang.org>2022-07-18 19:07:55 +0900
commita74634de106df63fb39a7077561657bb61a0bc97 (patch)
tree6d71307ea1df49a7c664b030c0a18959a58be5b4 /test
parent01560e1c53ce2e1fcf3cdc2480c6f75ca7c6f0a6 (diff)
downloadruby-a74634de106df63fb39a7077561657bb61a0bc97.tar.gz
[rubygems/rubygems] Fix upgrading RubyGems with a customized `Gem.default_dir`
https://github.com/rubygems/rubygems/commit/16d01f9486
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index ab563b28ee..69db09f747 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -228,6 +228,24 @@ class TestGemCommandsSetupCommand < Gem::TestCase
assert_path_exist "#{Gem.dir}/gems/bundler-audit-1.0.0"
end
+ def test_install_default_bundler_gem_with_default_gems_not_installed_at_default_dir
+ @cmd.extend FileUtils
+
+ gemhome2 = File.join(@tempdir, 'gemhome2')
+ Gem.instance_variable_set(:@default_dir, gemhome2)
+
+ FileUtils.mkdir_p gemhome2
+ bin_dir = File.join(gemhome2, 'bin')
+
+ @cmd.install_default_bundler_gem bin_dir
+
+ default_dir = Gem.default_specifications_dir
+
+ # expect to remove other versions of bundler gemspecs on default specification directory.
+ assert_path_not_exist File.join(default_dir, "bundler-1.15.4.gemspec")
+ assert_path_exist File.join(default_dir, "bundler-#{BUNDLER_VERS}.gemspec")
+ end
+
def test_install_default_bundler_gem_with_force_flag
@cmd.extend FileUtils