diff options
author | Keith Shook <keith.shook@ontariosystems.com> | 2015-03-06 09:57:04 -0500 |
---|---|---|
committer | Keith Shook <keith.shook@ontariosystems.com> | 2015-03-06 09:57:04 -0500 |
commit | 1f0e5c19e19b2a2d83a67da4e5d38fff26a4d4c5 (patch) | |
tree | d953cd492d4af62fc1829c0e8ad87e4d70649f3d | |
parent | 1c6ed5a9629851613aee87c454d64f15bc80fa12 (diff) | |
download | bundler-1f0e5c19e19b2a2d83a67da4e5d38fff26a4d4c5.tar.gz |
Added a test that exposes a scenario in some versions of bundler where a bundle install gets a lower version of a direct requirement than it should. See https://github.com/bundler/bundler/issues/3459
-rw-r--r-- | spec/resolver/basic_spec.rb | 14 | ||||
-rw-r--r-- | spec/support/indexes.rb | 72 |
2 files changed, 86 insertions, 0 deletions
diff --git a/spec/resolver/basic_spec.rb b/spec/resolver/basic_spec.rb index 1245898564..5b1748fbaa 100644 --- a/spec/resolver/basic_spec.rb +++ b/spec/resolver/basic_spec.rb @@ -62,4 +62,18 @@ describe "Resolving" do }.to raise_error(Bundler::CyclicDependencyError, /please remove either gem 'bar' or gem 'foo'/i) end + # Issue #3459 + it "should install the latest possible version of a direct requirement with no constraints given" do + @index = a_complicated_index + dep "foo" + should_resolve_and_include %w(foo-3.0.5) + end + + # Issue #3459 + it "should install the latest possible version of a direct requirement with constraints given" do + @index = a_complicated_index + dep "foo", ">= 3.0.0" + should_resolve_and_include %w(foo-3.0.5) + end + end diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb index 5aba3e2133..5b98bf458e 100644 --- a/spec/support/indexes.rb +++ b/spec/support/indexes.rb @@ -29,6 +29,14 @@ module Spec expect(got).to eq(specs.sort) end + def should_resolve_and_include(specs) + got = resolve + got = got.map { |s| s.full_name }.sort + specs.each do |s| + expect(got).to include(s) + end + end + def should_conflict_on(names) begin got = resolve @@ -197,6 +205,70 @@ module Spec end end + # Issue #3459 + def a_complicated_index + build_index do + + gem "foo", %w{3.0.0 3.0.5} do + dep "qux", ["~> 3.1"] + dep "baz", ["< 9.0", ">= 5.0"] + dep "bar", ["~> 1.0"] + dep "grault", ["~> 3.1"] + end + + gem "foo", "1.2.1" do + dep "baz", ["~> 4.2"] + dep "bar", ["~> 1.0"] + dep "qux", ["~> 3.1"] + dep "grault", ["~> 2.0"] + end + + gem "bar", "1.0.5" do + dep "grault", ["~> 3.1"] + dep "baz", ["< 9", ">= 4.2"] + end + + gem "bar", "1.0.3" do + dep "baz", ["< 9", ">= 4.2"] + dep "grault", ["~> 2.0"] + end + + gem "baz", "8.2.10" do + dep "grault", ["~> 3.0"] + dep "garply", [">= 0.5.1", "~> 0.5"] + end + + gem "baz", "5.0.2" do + dep "grault", ["~> 2.0"] + dep "garply", [">= 0.3.1"] + end + + gem "baz", "4.2.0" do + dep "grault", ["~> 2.0"] + dep "garply", [">= 0.3.1"] + end + + gem "grault", %w{2.6.3 3.1.1} + + gem "garply", "0.5.1" do + dep "waldo", ["~> 0.1.3"] + end + + gem "waldo", "0.1.5" do + dep "plugh", ["~> 0.6.0"] + end + + gem "plugh", %w(0.6.3 0.6.11 0.7.0) + + gem "qux", "3.2.21" do + dep "plugh", [">= 0.6.4", "~> 0.6"] + dep "corge", ["~> 1.0"] + end + + gem "corge", "1.10.1" + end + end + def a_unresovable_child_index build_index do gem "json", %w(1.8.0) |