diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2023-03-03 13:34:08 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-03-17 18:50:55 +0900 |
commit | 12f0be14e2df3450b464c934f82c7b17a1678bd4 (patch) | |
tree | 409838077a9965c4debfaf802e896c015790d3d7 /spec/bundler/commands | |
parent | ddc4fd5644ae40e6b817fc534f0de0f9c867e7b7 (diff) | |
download | ruby-12f0be14e2df3450b464c934f82c7b17a1678bd4.tar.gz |
Don't ignore pre-releases when there's only one candidate
This should be a very rare edge case, however, it does happen when using
a .dev version of Bundler because in that case, that's the only version
that the resolver considers, and it should not be ignored.
We could've special cased this specifically for Bundler, but I think it
does make sense for every gem.
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r-- | spec/bundler/commands/lock_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index 160a17bf55..59a74b3083 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -998,6 +998,31 @@ RSpec.describe "bundle lock" do expect(lockfile).to include("autobuild (1.10.1)") end + # Newer rails depends on Bundler, while ancient Rails does not. Bundler tries + # a first resolution pass that does not consider pre-releases. However, when + # using a pre-release Bundler (like the .dev version), that results in that + # pre-release being ignored and resolving to a version that does not depend on + # Bundler at all. We should avoid that and still consider .dev Bundler. + # + it "does not ignore prereleases with there's only one candidate" do + build_repo4 do + build_gem "rails", "7.4.0.2" do |s| + s.add_dependency "bundler", ">= 1.15.0" + end + + build_gem "rails", "2.3.18" + end + + gemfile <<~G + source "#{file_uri_for(gem_repo4)}" + gem "rails" + G + + bundle "lock" + expect(lockfile).to_not include("rails (2.3.18)") + expect(lockfile).to include("rails (7.4.0.2)") + end + it "deals with platform specific incompatibilities" do build_repo4 do build_gem "activerecord", "6.0.6" |