diff options
-rw-r--r-- | lib/bundler.rb | 7 | ||||
-rw-r--r-- | spec/runtime/setup_spec.rb | 15 |
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 |