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

Commit

Permalink
Merge #7482
Browse files Browse the repository at this point in the history
7482: Fixed test failures with gem command path on ruby core repo r=deivid-rodriguez a=hsbt

### What was the end-user problem that led to this PR?

Some of the examples failed with ruby-core repository.

### What was your diagnosis of the problem?

The ruby-core repository used `gem` commands under the its repository named `bin/gem` directory. But the current examples points `gem` command with a global path.

### What is your fix for the problem, implemented in this PR?

I fixed them used by `ruby_core?` helper methods.

Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
(cherry picked from commit 4045ba4)
  • Loading branch information
bundlerbot authored and deivid-rodriguez committed Dec 15, 2019
1 parent 2b781e5 commit acf122d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
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

0 comments on commit acf122d

Please sign in to comment.