summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel E. Giddins <segiddins@segiddins.me>2015-03-22 00:56:32 -0700
committerSamuel E. Giddins <segiddins@segiddins.me>2015-03-22 23:51:12 -0700
commitc65a44d3569d916a3e2691e8524736767aee2504 (patch)
tree1364017d3e12758f5f1e4b72a442a71bf3ac7fdf
parente080949222b1cc00d7a443d90a0589940fbb79f1 (diff)
downloadbundler-seg-fix-setup.tar.gz
[Setup] Fix multiple non-additive invocations of Bundler.setup with different groupsseg-fix-setup
-rw-r--r--lib/bundler.rb7
-rw-r--r--spec/runtime/setup_spec.rb15
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 83c066e5e5..478afd9bf4 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -120,12 +120,7 @@ module Bundler
# Load all groups, but only once
@setup = load.setup
else
- @completed_groups ||= []
- # Figure out which groups haven't been loaded yet
- unloaded = groups - @completed_groups
- # Record groups that are now loaded
- @completed_groups = groups
- unloaded.any? ? load.setup(*groups) : load
+ load.setup(*groups)
end
end
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 02ce0de369..2834689db1 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -90,6 +90,21 @@ describe "Bundler.setup" do
expect(err).to eq("")
expect(out).to match("WIN")
end
+
+ it "handles multiple non-additive invocations" do
+ ruby <<-RUBY
+ require 'bundler'
+ Bundler.setup(:default, :test)
+ Bundler.setup(:default)
+ require 'rack'
+
+ puts "FAIL"
+ RUBY
+
+ expect(err).to match("rack")
+ expect(err).to match("LoadError")
+ expect(out).not_to match("FAIL")
+ end
end
it "raises if the Gemfile was not yet installed" do