summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2018-09-13 04:30:32 +0000
committerColby Swandale <me@colby.fyi>2018-09-14 22:26:18 +1000
commit2791ea6912ed6dfa1c7abbb3bedb74fcb50377f2 (patch)
treee0288441312ac41788abec2ff71f9a7f945379e6 /spec
parent993cea20849a845e44b7429a709ba101c5889dd0 (diff)
downloadbundler-2791ea6912ed6dfa1c7abbb3bedb74fcb50377f2.tar.gz
Auto merge of #6695 - bundler:segiddins/6684-gvp-prefer-non-pres, r=colby-swandale
[GemVersionPromoter] Prefer non-pre-release versions ### What was the end-user problem that led to this PR? The problem was `bundle update --patch` could cause a prerelease to be resolved, when it shouldn't have been. Closes #6684. ### What was your diagnosis of the problem? My diagnosis was the resolver moved pre's to be first when no pre requirement was specified, but then the GVP did its own sorting. ### What is your fix for the problem, implemented in this PR? My fix was to re-implement that "pre's go first unless they were explicitly requested" logic in the GVP. ### Why did you choose this fix out of the possible options? I chose this fix because it allows the GVP to properly sort versions, making it entirely correct without dependence upon the resolver. (cherry picked from commit 87f49b2dc000b38776e6a73924e63ec090d53062)
Diffstat (limited to 'spec')
-rw-r--r--spec/resolver/basic_spec.rb12
-rw-r--r--spec/support/indexes.rb1
2 files changed, 13 insertions, 0 deletions
diff --git a/spec/resolver/basic_spec.rb b/spec/resolver/basic_spec.rb
index 0577a718b9..c023f5d7aa 100644
--- a/spec/resolver/basic_spec.rb
+++ b/spec/resolver/basic_spec.rb
@@ -87,6 +87,18 @@ RSpec.describe "Resolving" do
should_resolve_as %w[activesupport-3.0.0.beta actionpack-3.0.0.beta rack-1.1 rack-mount-0.6]
end
+ it "prefers non-pre-releases when doing conservative updates" do
+ @index = build_index do
+ gem "mail", "2.7.0"
+ gem "mail", "2.7.1.rc1"
+ gem "RubyGems\0", Gem::VERSION
+ end
+ dep "mail"
+ @locked = locked ["mail", "2.7.0"]
+ @base = locked
+ should_conservative_resolve_and_include [:patch], [], ["mail-2.7.0"]
+ end
+
it "raises an exception if a child dependency is not resolved" do
@index = a_unresovable_child_index
dep "chef_app_error"
diff --git a/spec/support/indexes.rb b/spec/support/indexes.rb
index c56d6145a7..69f8d9f679 100644
--- a/spec/support/indexes.rb
+++ b/spec/support/indexes.rb
@@ -66,6 +66,7 @@ module Spec
search = Bundler::GemVersionPromoter.new(@locked, unlock).tap do |s|
s.level = opts.first
s.strict = opts.include?(:strict)
+ s.prerelease_specified = Hash[@deps.map {|d| [d.name, d.requirement.prerelease?] }]
end
should_resolve_and_include specs, [@base, search]
end