summaryrefslogtreecommitdiff
path: root/spec/bundler/commands/exec_spec.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-15 21:31:12 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-22 20:32:30 +0900
commitc7ebeb7eda9f7f6bbb48effe1efc026eeb64d09c (patch)
treeb516b3b5119331d4d8431b4d17f552e2c8e798fe /spec/bundler/commands/exec_spec.rb
parentf4f157fc81b940c0f76a01ee266a08e6bba69b6b (diff)
Sync Bundler PR #3624
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3114
Diffstat (limited to 'spec/bundler/commands/exec_spec.rb')
-rw-r--r--spec/bundler/commands/exec_spec.rb35
1 files changed, 19 insertions, 16 deletions
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index f381a51263..08ebfe5ead 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -6,7 +6,7 @@ RSpec.describe "bundle exec" do
system_gems(system_gems_to_install, :path => default_bundle_path)
end
- it "works with --gemfile flag", :ruby_repo do
+ it "works with --gemfile flag" do
create_file "CustomGemfile", <<-G
gem "rack", "1.0.0"
G
@@ -15,7 +15,7 @@ RSpec.describe "bundle exec" do
expect(out).to eq("1.0.0")
end
- it "activates the correct gem", :ruby_repo do
+ it "activates the correct gem" do
gemfile <<-G
gem "rack", "0.9.1"
G
@@ -24,7 +24,7 @@ RSpec.describe "bundle exec" do
expect(out).to eq("0.9.1")
end
- it "works when the bins are in ~/.bundle", :ruby_repo do
+ it "works when the bins are in ~/.bundle" do
install_gemfile <<-G
gem "rack"
G
@@ -33,7 +33,7 @@ RSpec.describe "bundle exec" do
expect(out).to eq("1.0.0")
end
- it "works when running from a random directory", :ruby_repo do
+ it "works when running from a random directory" do
install_gemfile <<-G
gem "rack"
G
@@ -269,7 +269,7 @@ RSpec.describe "bundle exec" do
)
end
- it "handles gems installed with --without", :ruby_repo do
+ it "handles gems installed with --without" do
install_gemfile <<-G, forgotten_command_line_options(:without => "middleware")
source "#{file_uri_for(gem_repo1)}"
gem "rack" # rack 0.9.1 and 1.0 exist
@@ -353,7 +353,7 @@ RSpec.describe "bundle exec" do
expect(err).to include("bundler: exec needs a command to run")
end
- it "raises a helpful error when exec'ing to something outside of the bundle", :ruby_repo do
+ it "raises a helpful error when exec'ing to something outside of the bundle" do
bundle! "config set clean false" # want to keep the rackup binstub
install_gemfile! <<-G
source "#{file_uri_for(gem_repo1)}"
@@ -457,7 +457,7 @@ RSpec.describe "bundle exec" do
end
describe "with gem executables" do
- describe "run from a random directory", :ruby_repo do
+ describe "run from a random directory" do
before(:each) do
install_gemfile <<-G
gem "rack"
@@ -598,8 +598,9 @@ RSpec.describe "bundle exec" do
end
Bundler.rubygems.extend(Monkey)
G
- bundle "install --deployment"
- bundle "exec ruby -e '`#{bindir.join("bundler")} -v`; puts $?.success?'"
+ bundle! "config set path.system true"
+ bundle! "install"
+ bundle "exec ruby -e '`bundle -v`; puts $?.success?'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }
expect(out).to match("true")
end
end
@@ -881,7 +882,7 @@ __FILE__: #{path.to_s.inspect}
puts `bundle exec echo foo`
RUBY
file.chmod(0o777)
- bundle! "exec #{file}"
+ bundle! "exec #{file}", :env => { "PATH" => path }
expect(out).to eq("foo")
end
end
@@ -904,7 +905,7 @@ __FILE__: #{path.to_s.inspect}
end
end
- system_gems(:bundler, "openssl-#{openssl_version}", :gem_repo => gem_repo4)
+ system_gems("openssl-#{openssl_version}", :gem_repo => gem_repo4)
file = bundled_app("require_openssl.rb")
create_file(file, <<-RUBY)
@@ -915,15 +916,17 @@ __FILE__: #{path.to_s.inspect}
RUBY
file.chmod(0o777)
+ env = { "PATH" => path }
aggregate_failures do
- 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)
- expect(run!(file.read, :artifice => nil)).to eq(expected)
+ expect(bundle!("exec #{file}", :artifice => nil, :env => env)).to eq(expected)
+ expect(bundle!("exec bundle exec #{file}", :artifice => nil, :env => env)).to eq(expected)
+ expect(bundle!("exec ruby #{file}", :artifice => nil, :env => env)).to eq(expected)
+ expect(run!(file.read, :artifice => nil, :env => env)).to eq(expected)
end
+ skip "ruby_core has openssl and rubygems in the same folder, and this test needs rubygems require but default openssl not in a directly added entry in $LOAD_PATH" if ruby_core?
# sanity check that we get the newer, custom version without bundler
- sys_exec("#{Gem.ruby} #{file}")
+ sys_exec("#{Gem.ruby} #{file}", :env => env)
expect(err).to include("custom openssl should not be loaded")
end
end