diff options
author | Glenn Espinosa <glennpeter.espinosa@gmail.com> | 2017-06-24 14:50:50 -0400 |
---|---|---|
committer | Glenn Espinosa <glennpeter.espinosa@gmail.com> | 2017-06-24 14:50:50 -0400 |
commit | b6c3d273ab868bb091ca181ae2f0f73cd61e5331 (patch) | |
tree | aa8003e27ca910164d740ccba81986688d9b187b | |
parent | a14b5c02da80dc74bdafc660f592c5c4d0c8740d (diff) | |
download | bundler-b6c3d273ab868bb091ca181ae2f0f73cd61e5331.tar.gz |
Allow BUNDLE_GEMFILE to not be an absolute path
-rw-r--r-- | lib/bundler/shared_helpers.rb | 2 | ||||
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 07880387f0..bdc2aad113 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -191,7 +191,7 @@ module Bundler def find_gemfile(order_matters = false) given = ENV["BUNDLE_GEMFILE"] - return given if given && !given.empty? + return File.expand_path(given) if given && !given.empty? names = gemfile_names names.reverse! if order_matters && Bundler.feature_flag.prefer_gems_rb? find_file(*names) diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index 8586079974..880724180f 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -101,7 +101,7 @@ RSpec.describe Bundler::SharedHelpers do context "currently in directory with a Gemfile" do before { File.new("Gemfile", "w") } - it "returns path of the bundle gemfile" do + it "returns path of the bundle Gemfile" do expect(subject.in_bundle?).to eq("#{bundled_app}/Gemfile") end end @@ -121,6 +121,14 @@ RSpec.describe Bundler::SharedHelpers do end end + context "ENV['BUNDLE_GEMFILE'] is set without an absolute path" do + before { ENV["BUNDLE_GEMFILE"] = "Gemfile" } + + it "returns path of the bundle Gemfile" do + expect(subject.in_bundle?).to eq("#{bundled_app}/Gemfile") + end + end + context "ENV['BUNDLE_GEMFILE'] not set" do before { ENV["BUNDLE_GEMFILE"] = nil } |