summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-01-02 17:58:40 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2020-01-02 17:58:40 +0100
commit061982bc2ad8ab719ee5d30cd1f793389abb1711 (patch)
tree1b9eb490ea6b089efdaa4100dc85e99fd80d402f
parente70d0f3d02c8c084b61969e71d1fa28a15a6d0ca (diff)
downloadbundler-fix/bundler_inline.tar.gz
Reset `Gemfile` to the empty string after bundler/inlinefix/bundler_inline
To avoid Gemfile resolution afterwards, and use the "inline environment" instead.
-rw-r--r--lib/bundler/inline.rb2
-rw-r--r--spec/runtime/inline_spec.rb17
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb
index 5b2ddb7db6..f1f77a7a9c 100644
--- a/lib/bundler/inline.rb
+++ b/lib/bundler/inline.rb
@@ -78,7 +78,7 @@ def gemfile(install = false, options = {}, &gemfile)
if old_gemfile
ENV["BUNDLE_GEMFILE"] = old_gemfile
else
- ENV.delete("BUNDLE_GEMFILE")
+ ENV["BUNDLE_GEMFILE"] = ""
end
end
end
diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb
index 94d8b086a2..cd762fe636 100644
--- a/spec/runtime/inline_spec.rb
+++ b/spec/runtime/inline_spec.rb
@@ -333,4 +333,21 @@ RSpec.describe "bundler/inline#gemfile" do
expect(last_command).to be_success
expect(out).to include("BUNDLE_GEMFILE is empty")
end
+
+ it "resets BUNDLE_GEMFILE to the empty string if it wasn't set previously" do
+ ENV["BUNDLE_GEMFILE"] = nil
+ script <<-RUBY
+ gemfile do
+ source "#{file_uri_for(gem_repo1)}"
+ gem "rack"
+ end
+
+ puts "BUNDLE_GEMFILE is empty" if ENV["BUNDLE_GEMFILE"].empty?
+ system("#{Gem.ruby} -w -e '42'") # this should see original value of BUNDLE_GEMFILE
+ exit $?.exitstatus
+ RUBY
+
+ expect(last_command).to be_success
+ expect(out).to include("BUNDLE_GEMFILE is empty")
+ end
end