diff options
author | Bundlerbot <bot@bundler.io> | 2019-12-14 16:33:40 +0000 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-12-15 12:15:50 +0100 |
commit | acf122dc63f90174e5d6cd0e71a51768fc5007e4 (patch) | |
tree | 770b25764957dba8721c62cb0ad6892c385152e7 /spec | |
parent | 2b781e5ab96f5eeefa069f6503aba4250a2627f0 (diff) | |
download | bundler-acf122dc63f90174e5d6cd0e71a51768fc5007e4.tar.gz |
Merge #7482
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 4045ba4bb1b19c8c43178daae1918f38d11c6af6)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/gem_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/commands/exec_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/path.rb | 6 | ||||
-rw-r--r-- | spec/support/rubygems_ext.rb | 2 |
4 files changed, 8 insertions, 4 deletions
diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index c01d65d5dd..29e10d64f8 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -235,7 +235,7 @@ RSpec.describe Bundler::GemHelper do 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 diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index a5d67c6d68..c1d6e4c25a 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -57,7 +57,7 @@ RSpec.describe "bundle exec" do 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 diff --git a/spec/support/path.rb b/spec/support/path.rb index eea3161b15..645da52c97 100644 --- a/spec/support/path.rb +++ b/spec/support/path.rb @@ -21,8 +21,12 @@ module Spec @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 diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index 7e9e8328c5..ee9c750a52 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -99,7 +99,7 @@ module Spec 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 |