diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-07-20 17:17:59 -0700 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-07-20 17:17:59 -0700 |
commit | 6b5b79dbe3fe9af863fec0b0df4fa0a7134ec2e0 (patch) | |
tree | 711f3e432f5646cb9921f12fe3c6aff61e6fd2ca /spec/lock | |
parent | 7c01c7e7fb17763c9a0b709a83443b536494d048 (diff) | |
download | bundler-6b5b79dbe3fe9af863fec0b0df4fa0a7134ec2e0.tar.gz |
Appropriately handle duplicate declarations of the same gem. In incompatible cases, raise right away. Otherwise, try to do the right thing.
Diffstat (limited to 'spec/lock')
-rw-r--r-- | spec/lock/flex_spec.rb | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/spec/lock/flex_spec.rb b/spec/lock/flex_spec.rb index 55f6b53c5b..160121933b 100644 --- a/spec/lock/flex_spec.rb +++ b/spec/lock/flex_spec.rb @@ -496,6 +496,92 @@ describe "the lockfile format" do G end + it "does not add duplicate dependencies" do + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack" + gem "rack" + G + + lockfile_should_be <<-G + GEM + remote: file:#{gem_repo1}/ + specs: + rack (1.0.0) + + PLATFORMS + ruby + + DEPENDENCIES + rack + G + end + + it "does not add duplicate dependencies with versions" do + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack", "1.0" + gem "rack", "1.0" + G + + lockfile_should_be <<-G + GEM + remote: file:#{gem_repo1}/ + specs: + rack (1.0.0) + + PLATFORMS + ruby + + DEPENDENCIES + rack (= 1.0) + G + end + + it "does not add duplicate dependencies in different groups" do + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack", "1.0", :group => :one + gem "rack", "1.0", :group => :two + G + + lockfile_should_be <<-G + GEM + remote: file:#{gem_repo1}/ + specs: + rack (1.0.0) + + PLATFORMS + ruby + + DEPENDENCIES + rack (= 1.0) + G + end + + it "raises if two different versions are used" do + install_gemfile <<-G, :expect_err => true + source "file://#{gem_repo1}" + gem "rack", "1.0" + gem "rack", "1.1" + G + + bundled_app("Gemfile.lock").should_not exist + err.should include "rack (= 1.0) and rack (= 1.1)" + end + + + it "raises if two different versions are used" do + install_gemfile <<-G, :expect_err => true + source "file://#{gem_repo1}" + gem "rack" + gem "rack", :git => "git://hubz.com" + G + + bundled_app("Gemfile.lock").should_not exist + err.should include "rack (>= 0) should come from an unspecfied source and git://hubz.com (at master)" + end + it "works correctly with multiple version dependencies" do install_gemfile <<-G source "file://#{gem_repo1}" |