aboutsummaryrefslogtreecommitdiffstats
path: root/spec/runtime/require_spec.rb
diff options
context:
space:
mode:
authorBrandon Dimcheff <bdimchef-git@wieldim.com>2010-02-15 01:34:08 -0500
committerAndre Arko <andre@arko.net>2010-02-15 00:28:01 -0800
commit46629f03024297bf71cf41b8161b417c2446d971 (patch)
tree7dc14a2a4b9def53872b897961d6646f48f0ca9e /spec/runtime/require_spec.rb
parentdf14734e16107ec55ab9db9dd26b3f7abff839d7 (diff)
downloadbundler-46629f03024297bf71cf41b8161b417c2446d971.tar.gz
make requires occur in the order that Resolver determines
Diffstat (limited to 'spec/runtime/require_spec.rb')
-rw-r--r--spec/runtime/require_spec.rb35
1 files changed, 31 insertions, 4 deletions
diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb
index ef666a66..8d0ae95d 100644
--- a/spec/runtime/require_spec.rb
+++ b/spec/runtime/require_spec.rb
@@ -28,6 +28,10 @@ describe "Bundler.require" do
s.write "lib/six.rb", "puts 'six'"
end
+ build_lib "seven", "1.0.0" do |s|
+ s.write "lib/seven.rb", "puts 'seven'"
+ end
+
gemfile <<-G
path "#{lib_path}"
gem "one", :group => :bar, :require => %w(baz qux)
@@ -36,39 +40,62 @@ describe "Bundler.require" do
gem "four", :require => false
gem "five"
gem "six", :group => "string"
+ gem "seven", :group => :not
G
end
it "requires the gems" do
+ # default group
run "Bundler.require"
out.should == "two"
+ # specific group
run "Bundler.require(:bar)"
out.should == "baz\nqux"
+ # default and specific group
run "Bundler.require(:default, :bar)"
out.should == "two\nbaz\nqux"
- end
- it "requires the gems with strings as group names" do
- run 'Bundler.require("bar")'
+ # specific group given as a string
+ run "Bundler.require('bar')"
out.should == "baz\nqux"
- run 'Bundler.require(:string)'
+ # specific group declared as a string
+ run "Bundler.require(:string)"
out.should == "six"
+
+ # required in resolver order instead of gemfile order
+ run("Bundler.require(:not)")
+ out.should == "seven\nthree"
end
it "requires the locked gems" do
bundle :lock
+ # default group
out = ruby("require 'bundler'; Bundler.setup; Bundler.require")
out.should == "two"
+ # specific group
out = ruby("require 'bundler'; Bundler.setup(:bar); Bundler.require(:bar)")
out.should == "baz\nqux"
+ # default and specific group
out = ruby("require 'bundler'; Bundler.setup(:default, :bar); Bundler.require(:default, :bar)")
out.should == "two\nbaz\nqux"
+
+ # specific group given as a string
+ out = ruby("require 'bundler'; Bundler.setup('bar'); Bundler.require('bar')")
+ out.should == "baz\nqux"
+
+ # specific group declared as a string
+ out = ruby("require 'bundler'; Bundler.setup(:string); Bundler.require(:string)")
+ out.should == "six"
+
+ # required in resolver order instead of gemfile order
+ out = ruby("require 'bundler'; Bundler.setup(:not); Bundler.require(:not)")
+ out.should == "seven\nthree"
end
it "allows requiring gems with non standard names explicitly" do