aboutsummaryrefslogtreecommitdiffstats
path: root/spec/runtime/require_spec.rb
diff options
context:
space:
mode:
authorAndy Delcambre <adelcambre@engineyard.com>2010-03-19 12:43:42 -0700
committerAndy Delcambre <adelcambre@engineyard.com>2010-03-25 11:14:57 -0700
commitf17183b53edc96162cd2e20255d6bc315779b5cf (patch)
treef3d7d0892bb6a101e8f164926c24f4a916bcead3 /spec/runtime/require_spec.rb
parent8853c6b1db27793f4d5b7b7fc8ed65fb1877a3b6 (diff)
downloadbundler-f17183b53edc96162cd2e20255d6bc315779b5cf.tar.gz
Store dependencies in the Gemfile.lock as an array, not a hash
This makes Bundler.require require the gems in the order they appear in the Gemfile for both the locked and unlocked cases.
Diffstat (limited to 'spec/runtime/require_spec.rb')
-rw-r--r--spec/runtime/require_spec.rb69
1 files changed, 69 insertions, 0 deletions
diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb
index 7329e834..f73413c6 100644
--- a/spec/runtime/require_spec.rb
+++ b/spec/runtime/require_spec.rb
@@ -149,4 +149,73 @@ describe "Bundler.require" do
out.should == "two\nbaz\nqux"
end
end
+
+ describe "order" do
+ before(:each) do
+ build_lib "one", "1.0.0" do |s|
+ s.write "lib/one.rb", "Two.two; puts 'one'"
+ end
+
+ build_lib "two", "1.0.0" do |s|
+ s.write "lib/two.rb", <<-TWO
+ module Two
+ def self.two
+ puts 'module_two'
+ end
+ end
+ puts 'two'
+ TWO
+ end
+ end
+
+ it "works when the gems are in the Gemfile in the correct order" do
+ gemfile <<-G
+ path "#{lib_path}"
+ gem "two"
+ gem "one"
+ G
+
+ run "Bundler.require"
+ check out.should == "two\nmodule_two\none"
+ end
+
+ it "fails when the gems are in the Gemfile in the wrong order" do
+ gemfile <<-G
+ path "#{lib_path}"
+ gem "one"
+ gem "two"
+ G
+
+ run "Bundler.require", :expect_err => true
+ check err.should include("uninitialized constant Two")
+ end
+
+ describe "when locked" do
+ it "works when the gems are in the Gemfile in the correct order" do
+ gemfile <<-G
+ path "#{lib_path}"
+ gem "two"
+ gem "one"
+ G
+
+ bundle :lock
+
+ run "Bundler.require"
+ check out.should == "two\nmodule_two\none"
+ end
+
+ it "fails when the gems are in the Gemfile in the wrong order" do
+ gemfile <<-G
+ path "#{lib_path}"
+ gem "one"
+ gem "two"
+ G
+
+ bundle :lock
+
+ run "Bundler.require", :expect_err => true
+ check err.should include("uninitialized constant Two")
+ end
+ end
+ end
end