Skip to content

Commit

Permalink
Merge pull request rubygems#1379 from radsaq/bundler
Browse files Browse the repository at this point in the history
---

Dont hose existing load paths if Bundle.setup is called multiple times with a different set of groups.

This fixes rubygems#1230.
  • Loading branch information
indirect committed Sep 13, 2011
2 parents 711b240 + 671141d commit bc92a7b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/bundler.rb
Expand Up @@ -113,8 +113,7 @@ def setup(*groups)
unloaded = groups - @completed_groups
# Record groups that are now loaded
@completed_groups = groups
# Load any groups that are not yet loaded
unloaded.any? ? load.setup(*unloaded) : load
unloaded.any? ? load.setup(*groups) : load
end
end

Expand Down
19 changes: 19 additions & 0 deletions spec/runtime/setup_spec.rb
Expand Up @@ -25,6 +25,7 @@
before(:each) do
install_gemfile <<-G
source "file://#{gem_repo1}"
gem "yard"
gem "rack", :group => :test
G
end
Expand Down Expand Up @@ -58,6 +59,24 @@
err.should eq("")
out.should eq("1.0.0")
end

it "leaves :default available if setup is called twice" do
ruby <<-RUBY
require 'rubygems'
require 'bundler'
Bundler.setup(:default)
Bundler.setup(:default, :test)
begin
require 'yard'
puts "WIN"
rescue LoadError
puts "FAIL"
end
RUBY
err.should eq("")
out.should match("WIN")
end
end

it "raises if the Gemfile was not yet installed" do
Expand Down

0 comments on commit bc92a7b

Please sign in to comment.