summaryrefslogtreecommitdiff
path: root/spec/bundler/install/bundler_spec.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-06-07 13:07:27 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-18 19:14:15 +0900
commitf8f3f11ed580074960e5de1de4552bdf14d7d70d (patch)
tree1f469bce4bda8dee09258b4d624b0367d82d5952 /spec/bundler/install/bundler_spec.rb
parenta447563cf899f2a33511c12735160a8bbd0efecd (diff)
[rubygems/rubygems] Fix `only_update_to_newer_versions` regression
The `only_update_to_newer_versions` feature flag will enable some new behaviour in bundler 3 (or maybe earlier if we decide to consider it a bug fix) that prevents `bundle update` from unexpectedly downgrading direct dependencies. This seems reasonable, but the current implementation is adding additional requirements for all locked dependencies, not only from the ones in the `Gemfile`. That causes some situations where the `Gemfile` is edited and will resolve to older versions to start failing. This commit fixes the problem by making sure extra requirements are added exclusively for direct dependencies in the `Gemfile`, not for all direct dependencies in the lock file. https://github.com/rubygems/rubygems/commit/128b4596e1
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3212
Diffstat (limited to 'spec/bundler/install/bundler_spec.rb')
-rw-r--r--spec/bundler/install/bundler_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/bundler/install/bundler_spec.rb b/spec/bundler/install/bundler_spec.rb
index 7c9b1a016d..5e15333ad8 100644
--- a/spec/bundler/install/bundler_spec.rb
+++ b/spec/bundler/install/bundler_spec.rb
@@ -131,6 +131,21 @@ RSpec.describe "bundle install" do
expect(err).to include(nice_error)
end
+ it "does not cause a conflict if new dependencies in the Gemfile require older dependencies than the lockfile" do
+ install_gemfile! <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem 'rails', "2.3.2"
+ G
+
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ gem "rails_fail"
+ G
+
+ expect(out).to include("Installing activesupport 1.2.3 (was 2.3.2)")
+ expect(err).to be_empty
+ end
+
it "can install dependencies with newer bundler version with system gems" do
bundle! "config set path.system true"