summaryrefslogtreecommitdiff
path: root/spec/runtime/setup_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/runtime/setup_spec.rb')
-rw-r--r--spec/runtime/setup_spec.rb54
1 files changed, 42 insertions, 12 deletions
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 909378ab02..34caceba5a 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -269,21 +269,51 @@ RSpec.describe "Bundler.setup" do
expect(bundled_app("Gemfile.lock")).to exist
end
- it "uses BUNDLE_GEMFILE to locate the gemfile if present" do
- gemfile <<-G
- source "file://#{gem_repo1}"
- gem "rack"
- G
+ describe "$BUNDLE_GEMFILE" do
+ context "user provides an absolute path" do
+ it "uses BUNDLE_GEMFILE to locate the gemfile if present" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
- gemfile bundled_app("4realz"), <<-G
- source "file://#{gem_repo1}"
- gem "activesupport", "2.3.5"
- G
+ gemfile bundled_app("4realz"), <<-G
+ source "file://#{gem_repo1}"
+ gem "activesupport", "2.3.5"
+ G
+
+ ENV["BUNDLE_GEMFILE"] = bundled_app("4realz").to_s
+ bundle :install
+
+ expect(the_bundle).to include_gems "activesupport 2.3.5"
+ end
+ end
+
+ context "an absolute path is not provided" do
+ it "uses BUNDLE_GEMFILE to locate the gemfile if present" do
+ gemfile <<-G
+ source "file://#{gem_repo1}"
+ G
- ENV["BUNDLE_GEMFILE"] = bundled_app("4realz").to_s
- bundle :install
+ bundle "install"
+ bundle "install --deployment"
- expect(the_bundle).to include_gems "activesupport 2.3.5"
+ ENV["BUNDLE_GEMFILE"] = "Gemfile"
+ ruby <<-R
+ require 'rubygems'
+ require 'bundler'
+
+ begin
+ Bundler.setup
+ puts "WIN"
+ rescue ArgumentError => e
+ puts "FAIL"
+ end
+ R
+
+ expect(out).to eq("WIN")
+ end
+ end
end
it "prioritizes gems in BUNDLE_PATH over gems in GEM_HOME" do