Skip to content

Commit

Permalink
Remove unnecessary test setup
Browse files Browse the repository at this point in the history
The method being unit tested here doesn't use
`RbConfig::CONFIG["bindir"]`.
  • Loading branch information
deivid-rodriguez committed Nov 5, 2021
1 parent bd4bd97 commit d3f092a
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions test/rubygems/test_gem_commands_setup_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,20 @@ def test_install_default_bundler_gem_with_force_flag
f.puts 'echo "hello"'
end

bindir(bin_dir) do
@cmd.options[:force] = true
@cmd.options[:force] = true

@cmd.install_default_bundler_gem bin_dir

bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
default_spec_path = File.join(Gem.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
spec = Gem::Specification.load(default_spec_path)
@cmd.install_default_bundler_gem bin_dir

spec.executables.each do |e|
if Gem.win_platform?
assert_path_exist File.join(bin_dir, "#{e}.bat")
end
bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
default_spec_path = File.join(Gem.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
spec = Gem::Specification.load(default_spec_path)

assert_path_exist File.join bin_dir, e
spec.executables.each do |e|
if Gem.win_platform?
assert_path_exist File.join(bin_dir, "#{e}.bat")
end

assert_path_exist File.join bin_dir, e
end
end

Expand All @@ -249,18 +247,16 @@ def test_install_default_bundler_gem_with_destdir_flag

bin_dir = File.join(@gemhome, 'bin')

bindir(bin_dir) do
destdir = File.join(@tempdir, 'foo')
destdir = File.join(@tempdir, 'foo')

@cmd.options[:destdir] = destdir
@cmd.options[:destdir] = destdir

@cmd.install_default_bundler_gem bin_dir
@cmd.install_default_bundler_gem bin_dir

spec = Gem::Specification.load("bundler/bundler.gemspec")
spec = Gem::Specification.load("bundler/bundler.gemspec")

spec.executables.each do |e|
assert_path_exist File.join destdir, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'gems', spec.full_name, spec.bindir, e
end
spec.executables.each do |e|
assert_path_exist File.join destdir, @gemhome.gsub(/^[a-zA-Z]:/, ''), 'gems', spec.full_name, spec.bindir, e
end
end

Expand Down

0 comments on commit d3f092a

Please sign in to comment.