[rubygems/rubygems] Unify common logic

https://github.com/rubygems/rubygems/commit/e5434be14c
This commit is contained in:
David Rodríguez 2022-07-16 13:31:24 +02:00 коммит произвёл git
Родитель cbaf58d455
Коммит bdef3c73fe
1 изменённых файлов: 12 добавлений и 8 удалений

Просмотреть файл

@ -211,11 +211,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
assert_path_exist File.join bin_dir, e assert_path_exist File.join bin_dir, e
end end
default_dir = Gem.default_specifications_dir
# expect to remove other versions of bundler gemspecs on default specification directory. # 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_not_exist previous_bundler_specification_path
assert_path_exist File.join(default_dir, "bundler-#{BUNDLER_VERS}.gemspec") assert_path_exist new_bundler_specification_path
# expect to not remove bundler-* gemspecs. # expect to not remove bundler-* gemspecs.
assert_path_exist File.join(Gem.dir, "specifications", "bundler-audit-1.0.0.gemspec") assert_path_exist File.join(Gem.dir, "specifications", "bundler-audit-1.0.0.gemspec")
@ -239,11 +237,9 @@ class TestGemCommandsSetupCommand < Gem::TestCase
@cmd.install_default_bundler_gem bin_dir @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. # 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_not_exist previous_bundler_specification_path
assert_path_exist File.join(default_dir, "bundler-#{BUNDLER_VERS}.gemspec") assert_path_exist new_bundler_specification_path
end end
def test_install_default_bundler_gem_with_force_flag def test_install_default_bundler_gem_with_force_flag
@ -462,4 +458,12 @@ class TestGemCommandsSetupCommand < Gem::TestCase
def default_bundler_bin_path def default_bundler_bin_path
File.join RbConfig::CONFIG['bindir'], 'bundler' File.join RbConfig::CONFIG['bindir'], 'bundler'
end end
def previous_bundler_specification_path
File.join(Gem.default_specifications_dir, "bundler-1.15.4.gemspec")
end
def new_bundler_specification_path
File.join(Gem.default_specifications_dir, "bundler-#{BUNDLER_VERS}.gemspec")
end
end unless Gem.java_platform? end unless Gem.java_platform?