summaryrefslogtreecommitdiff
path: root/spec/bundler/commands
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-21 09:22:15 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-21 09:22:15 +0000
commit4525cf2cd599389be3fab30ae4c13e22050705b5 (patch)
tree33165c2a9ec72863caa8c476e380e36eeb9c6a69 /spec/bundler/commands
parent85277d5be0b24638ea4bf84c422e71a1219465e7 (diff)
Merge release version of bundler-1.16.1 from upstream.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r--spec/bundler/commands/exec_spec.rb30
-rw-r--r--spec/bundler/commands/newgem_spec.rb6
-rw-r--r--spec/bundler/commands/pristine_spec.rb5
-rw-r--r--spec/bundler/commands/update_spec.rb2
4 files changed, 27 insertions, 16 deletions
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 077e1b03a2..894db8cb36 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe "bundle exec" do
gem "rack"
G
- bundle "exec 'cd #{tmp("gems")} && rackup'"
+ bundle "exec 'cd #{tmp("gems")} && rackup'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
expect(out).to include("1.0.0")
end
@@ -42,7 +42,7 @@ RSpec.describe "bundle exec" do
it "works when exec'ing to ruby" do
install_gemfile 'gem "rack"'
- bundle "exec ruby -e 'puts %{hi}'"
+ bundle "exec ruby -e 'puts %{hi}'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
expect(out).to eq("hi")
end
@@ -76,7 +76,9 @@ RSpec.describe "bundle exec" do
G
install_gemfile ""
- sys_exec("#{Gem.ruby} #{command.path}")
+ with_env_vars "RUBYOPT" => "-r#{spec_dir.join("support/hax")}" do
+ sys_exec "#{Gem.ruby} #{command.path}"
+ end
if Bundler.current_ruby.ruby_2?
expect(out).to eq("")
@@ -237,7 +239,7 @@ RSpec.describe "bundle exec" do
G
[true, false].each do |l|
bundle! "config disable_exec_load #{l}"
- bundle "exec rackup"
+ bundle "exec rackup", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
expect(last_command.stderr).to include "rack is not part of the bundle. Add it to your Gemfile."
end
end
@@ -339,14 +341,14 @@ RSpec.describe "bundle exec" do
end
it "works when unlocked", :ruby_repo do
- bundle "exec 'cd #{tmp("gems")} && rackup'"
+ bundle "exec 'cd #{tmp("gems")} && rackup'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
expect(out).to eq("1.0.0")
expect(out).to include("1.0.0")
end
it "works when locked", :ruby_repo do
expect(the_bundle).to be_locked
- bundle "exec 'cd #{tmp("gems")} && rackup'"
+ bundle "exec 'cd #{tmp("gems")} && rackup'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
expect(out).to include("1.0.0")
end
end
@@ -472,7 +474,7 @@ RSpec.describe "bundle exec" do
Bundler.rubygems.extend(Monkey)
G
bundle "install --deployment"
- bundle "exec ruby -e '`#{bindir.join("bundler")} -v`; puts $?.success?'"
+ bundle "exec ruby -e '`#{bindir.join("bundler")} -v`; puts $?.success?'", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" }
expect(out).to match("true")
end
end
@@ -512,7 +514,7 @@ RSpec.describe "bundle exec" do
let(:expected) { [exec, args, rack, process].join("\n") }
let(:expected_err) { "" }
- subject { bundle "exec #{path} arg1 arg2" }
+ subject { bundle "exec #{path} arg1 arg2", :env => { :RUBYOPT => "-r#{spec_dir.join("support/hax")}" } }
shared_examples_for "it runs" do
it "like a normally executed executable" do
@@ -550,6 +552,7 @@ RSpec.describe "bundle exec" do
ex << "raise SignalException, 'SIGTERM'\n"
ex
end
+ let(:expected_err) { ENV["TRAVIS"] ? "Terminated" : "" }
let(:exit_code) do
# signal mask 128 + plus signal 15 -> TERM
# this is specified by C99
@@ -778,10 +781,13 @@ __FILE__: #{path.to_s.inspect}
file.chmod(0o777)
aggregate_failures do
- expect(bundle!("exec #{file}", :system_bundler => true, :artifice => nil)).to eq(expected)
- expect(bundle!("exec bundle exec #{file}", :system_bundler => true, :artifice => nil)).to eq(expected)
- expect(bundle!("exec ruby #{file}", :system_bundler => true, :artifice => nil)).to eq(expected)
- expect(run!(file.read, :no_lib => true, :artifice => nil)).to eq(expected)
+ expect(bundle!("exec #{file}", :artifice => nil)).to eq(expected)
+ expect(bundle!("exec bundle exec #{file}", :artifice => nil)).to eq(expected)
+ expect(bundle!("exec ruby #{file}", :artifice => nil)).to eq(expected)
+ # Ignore expectaion for default bundler gem conflict.
+ unless ENV["BUNDLER_SPEC_SUB_VERSION"]
+ expect(run!(file.read, :no_lib => true, :artifice => nil)).to eq(expected)
+ end
end
# sanity check that we get the newer, custom version without bundler
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index dcd89391a4..97695cc1cd 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -191,7 +191,7 @@ RSpec.describe "bundle gem" do
it "generates a valid gemspec" do
in_app_root
- bundle "gem newgem --bin"
+ bundle! "gem newgem --bin"
process_file(bundled_app("newgem", "newgem.gemspec")) do |line|
# Simulate replacing TODOs with real values
@@ -211,7 +211,9 @@ RSpec.describe "bundle gem" do
end
Dir.chdir(bundled_app("newgem")) do
- system_gems ["rake-10.0.2"], :path => :bundle_path
+ gems = ["rake-10.0.2", :bundler]
+ gems.delete(:bundler) if ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]
+ system_gems gems, :path => :bundle_path
bundle! "exec rake build"
end
diff --git a/spec/bundler/commands/pristine_spec.rb b/spec/bundler/commands/pristine_spec.rb
index ee75934380..24291c1918 100644
--- a/spec/bundler/commands/pristine_spec.rb
+++ b/spec/bundler/commands/pristine_spec.rb
@@ -41,11 +41,14 @@ RSpec.describe "bundle pristine", :ruby_repo do
end
it "does not delete the bundler gem", :ruby_repo do
+ ENV["BUNDLER_SPEC_KEEP_DEFAULT_BUNDLER_GEM"] = "true"
system_gems :bundler
bundle! "install"
bundle! "pristine", :system_bundler => true
bundle! "-v", :system_bundler => true
- expect(out).to end_with(Bundler::VERSION)
+ # An old rubygems couldn't handle a correct version of vendoered bundler.
+ bundler_version = Gem::VERSION < "2.1" ? "1.16.0" : Bundler::VERSION
+ expect(out).to end_with(bundler_version)
end
end
diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb
index a2842f0998..33679dd649 100644
--- a/spec/bundler/commands/update_spec.rb
+++ b/spec/bundler/commands/update_spec.rb
@@ -657,7 +657,7 @@ RSpec.describe "bundle update --bundler" do
source "file:#{gem_repo4}"
gem "rack"
G
- lockfile lockfile.sub(Bundler::VERSION, "1.0.0")
+ lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, '\11.0.0\2')
FileUtils.rm_r gem_repo4