aboutsummaryrefslogtreecommitdiffstats
path: root/spec/runtime/require_spec.rb
diff options
context:
space:
mode:
authorRhett Sutphin <rhett@detailedbalance.net>2010-03-02 12:56:06 -0600
committerRhett Sutphin <rhett@detailedbalance.net>2010-03-02 12:56:06 -0600
commit5a904339d1159d03c8ac8372554164e65e652d22 (patch)
tree25f994c67796d81cf667d2ad77e48801d0d1b03d /spec/runtime/require_spec.rb
parent9ec5ca3c4bb89dff628072eef3ec1e9760542b46 (diff)
downloadbundler-5a904339d1159d03c8ac8372554164e65e652d22.tar.gz
Specs which demonstrate cause of the problem reported as #153.
The existing require-from-locked specs use Bundler.setup. You are also (only?) supposed to be able to load `.bundle/environment.rb` and skip setup. These new specs do that and show that (in that case) using a string group name does not work.
Diffstat (limited to 'spec/runtime/require_spec.rb')
-rw-r--r--spec/runtime/require_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb
index ffabb79e..d8fe2837 100644
--- a/spec/runtime/require_spec.rb
+++ b/spec/runtime/require_spec.rb
@@ -99,6 +99,42 @@ describe "Bundler.require" do
out.should == "seven\nthree"
end
+ describe "after loading a locked environment.rb" do
+ before do
+ bundle :lock
+ @env = File.expand_path("../../../.bundle/environment.rb", __FILE__)
+ File.exist?(@env).should be_true
+ end
+
+ def output_from_require(*args)
+ @out = ruby("require '#{@env}'; Bundler.require(#{args.collect { |a| a.inspect }.join(", ")})")
+ end
+
+ it "can require the default group" do
+ output_from_require().should == "two"
+ end
+
+ it "can require some specific group" do
+ output_from_require(:bar).should == "baz\nqux"
+ end
+
+ it "can require the default and some specific group" do
+ output_from_require(:default, :bar).should == "two\nbaz\nqux"
+ end
+
+ it "can require a group as a string" do
+ output_from_require('bar').should == "baz\nqux"
+ end
+
+ it "can require a group that was declared as a string" do
+ output_from_require(:string).should == "six"
+ end
+
+ it "requires in resolver order not gemfile order" do
+ output_from_require(:not).should == "seven\nthree"
+ end
+ end
+
it "allows requiring gems with non standard names explicitly" do
run "Bundler.require ; require 'mofive'"
out.should == "two\nfive"