Skip to content

Commit

Permalink
[rubygems/rubygems] Unify common logic
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored and matzbot committed Jul 20, 2022
1 parent cbaf58d commit bdef3c7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/rubygems/test_gem_commands_setup_command.rb
Expand Up @@ -211,11 +211,9 @@ def test_install_default_bundler_gem
assert_path_exist File.join bin_dir, e
end

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")
assert_path_not_exist previous_bundler_specification_path
assert_path_exist new_bundler_specification_path

# expect to not remove bundler-* gemspecs.
assert_path_exist File.join(Gem.dir, "specifications", "bundler-audit-1.0.0.gemspec")
Expand All @@ -239,11 +237,9 @@ def test_install_default_bundler_gem_with_default_gems_not_installed_at_default_

@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")
assert_path_not_exist previous_bundler_specification_path
assert_path_exist new_bundler_specification_path
end

def test_install_default_bundler_gem_with_force_flag
Expand Down Expand Up @@ -462,4 +458,12 @@ def default_bundle_bin_path
def default_bundler_bin_path
File.join RbConfig::CONFIG['bindir'], 'bundler'
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?

0 comments on commit bdef3c7

Please sign in to comment.