Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Fixed test failures with gem command path on ruby core repo #7482

Merged
1 commit merged into from Dec 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/bundler/gem_helper_spec.rb
Expand Up @@ -235,7 +235,7 @@ def mock_build_message(name, version)
end

it "uses Kernel.system" do
expect(Kernel).to receive(:system).with("gem", "push", app_gem_path.to_s, "--host", "http://example.org").and_return(true)
expect(Kernel).to receive(:system).with(gem_bin, "push", app_gem_path.to_s, "--host", "http://example.org").and_return(true)

Rake.application["release"].invoke
end
Expand Down
2 changes: 1 addition & 1 deletion spec/commands/exec_spec.rb
Expand Up @@ -57,7 +57,7 @@

it "works when exec'ing to rubygems" do
install_gemfile 'gem "rack"'
bundle "exec gem --version"
bundle "exec #{gem_cmd} --version"
expect(out).to eq(Gem::VERSION)
end

Expand Down
6 changes: 5 additions & 1 deletion spec/support/path.rb
Expand Up @@ -21,8 +21,12 @@ def bindir
@bindir ||= root.join(ruby_core? ? "libexec" : "exe")
end

def gem_cmd
@gem_cmd ||= ruby_core? ? root.join("bin/gem") : "gem"
end

def gem_bin
@gem_bin ||= ruby_core? ? ENV["GEM_COMMAND"] : "#{Gem.ruby} -S gem --backtrace"
@gem_bin ||= ruby_core? ? ENV["GEM_COMMAND"] : "gem"
end

def spec_dir
Expand Down
2 changes: 1 addition & 1 deletion spec/support/rubygems_ext.rb
Expand Up @@ -99,7 +99,7 @@ def install_gems(gems)
no_reqs.map!(&:first)
reqs.map! {|name, req| "'#{name}:#{req}'" }
deps = reqs.concat(no_reqs).join(" ")
gem = Path.gem_bin
gem = ENV["GEM_COMMAND"] || "#{Gem.ruby} -S gem --backtrace"
cmd = "#{gem} install #{deps} --no-document --conservative"
system(cmd) || raise("Installing gems #{deps} for the tests to use failed!")
end
Expand Down