From 5a69a23afcc39a87bf808f484fa476978a9a0b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 16 Aug 2019 17:54:12 +0200 Subject: [PATCH] [bundler/bundler] Don't use system bundler on this spec If we use system bundler, when booting the "outermost" bundler process, bundler will save the path to the system bundler in BUNDLE_BIN_PATH, and use it again when booting the "innermost" bundler process (`bundle exec echo foo`). That means that second process will use the system bundler path again. However, we have `-rsupport/hax` in RUBYOPT, so that file will load from the local copy of bundler, and that file will load `bundler/version` from the project (not from system), because -Ilib is in the LOAD_PATH. That will end up causing redefinition errors because the same constant will be loaded from two different locations. In general, this is expected behavior, normally you will wrap the process with `Bundler.with_original_env` to reset the environment. However, the easiest fix here is to not use system bundler, because it's not really necessary and thus doesn't help the readability of the spec. https://github.com/bundler/bundler/commit/a3d72a34ab --- spec/bundler/commands/exec_spec.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 303dbb243a..ec75b9eb0d 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -837,14 +837,12 @@ __FILE__: #{path.to_s.inspect} context "nested bundle exec" do context "when bundle in a local path" do before do - system_gems :bundler - gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" G bundle "config set path vendor/bundler" - bundle! :install, :system_bundler => true + bundle! :install end it "correctly shells out", :ruby_repo do @@ -854,7 +852,7 @@ __FILE__: #{path.to_s.inspect} puts `bundle exec echo foo` RB file.chmod(0o777) - bundle! "exec #{file}", :system_bundler => true + bundle! "exec #{file}" expect(out).to eq("foo") end end