diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2022-08-01 16:41:31 +0200 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-08-03 16:33:52 +0900 |
commit | 35c65e7ba6b4aa8bc80aaca8429a48c4eb923b89 (patch) | |
tree | ffc55acf72d6ae45d324bd5b740b507de0202e2f /spec | |
parent | 71794a75db5d3da810146da106baf7eb5e86f745 (diff) | |
download | ruby-35c65e7ba6b4aa8bc80aaca8429a48c4eb923b89.tar.gz |
[rubygems/rubygems] Fix conservative updates regardless of `--strict`
https://github.com/rubygems/rubygems/commit/c9a1d69a8d
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/commands/outdated_spec.rb | 194 |
1 files changed, 96 insertions, 98 deletions
diff --git a/spec/bundler/commands/outdated_spec.rb b/spec/bundler/commands/outdated_spec.rb index a05a1ad4bb..6b7c95f01b 100644 --- a/spec/bundler/commands/outdated_spec.rb +++ b/spec/bundler/commands/outdated_spec.rb @@ -1098,127 +1098,125 @@ RSpec.describe "bundle outdated" do end context "conservative updates" do - context "without --strict" do - before do - build_repo4 do - build_gem "patch", %w[1.0.0 1.0.1] - build_gem "minor", %w[1.0.0 1.0.1 1.1.0] - build_gem "major", %w[1.0.0 1.0.1 1.1.0 2.0.0] - end + before do + build_repo4 do + build_gem "patch", %w[1.0.0 1.0.1] + build_gem "minor", %w[1.0.0 1.0.1 1.1.0] + build_gem "major", %w[1.0.0 1.0.1 1.1.0 2.0.0] + end - # establish a lockfile set to 1.0.0 - install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" - gem 'patch', '1.0.0' - gem 'minor', '1.0.0' - gem 'major', '1.0.0' - G + # establish a lockfile set to 1.0.0 + install_gemfile <<-G + source "#{file_uri_for(gem_repo4)}" + gem 'patch', '1.0.0' + gem 'minor', '1.0.0' + gem 'major', '1.0.0' + G - # remove all version requirements - gemfile <<-G - source "#{file_uri_for(gem_repo4)}" - gem 'patch' - gem 'minor' - gem 'major' - G - end + # remove all version requirements + gemfile <<-G + source "#{file_uri_for(gem_repo4)}" + gem 'patch' + gem 'minor' + gem 'major' + G + end - it "shows nothing when patching and filtering to minor" do - bundle "outdated --patch --filter-minor" + it "shows nothing when patching and filtering to minor" do + bundle "outdated --patch --filter-minor" - expect(out).to end_with("No minor updates to display.") - end + expect(out).to end_with("No minor updates to display.") + end - it "shows all gems when patching and filtering to patch" do - bundle "outdated --patch --filter-patch", :raise_on_error => false + it "shows all gems when patching and filtering to patch" do + bundle "outdated --patch --filter-patch", :raise_on_error => false - expected_output = <<~TABLE.strip - Gem Current Latest Requested Groups - major 1.0.0 1.0.1 >= 0 default - minor 1.0.0 1.0.1 >= 0 default - patch 1.0.0 1.0.1 >= 0 default - TABLE + expected_output = <<~TABLE.strip + Gem Current Latest Requested Groups + major 1.0.0 1.0.1 >= 0 default + minor 1.0.0 1.0.1 >= 0 default + patch 1.0.0 1.0.1 >= 0 default + TABLE - expect(out).to end_with(expected_output) - end + expect(out).to end_with(expected_output) + end - it "shows minor and major when updating to minor and filtering to patch and minor" do - bundle "outdated --minor --filter-minor", :raise_on_error => false + it "shows minor and major when updating to minor and filtering to patch and minor" do + bundle "outdated --minor --filter-minor", :raise_on_error => false - expected_output = <<~TABLE.strip - Gem Current Latest Requested Groups - major 1.0.0 1.1.0 >= 0 default - minor 1.0.0 1.1.0 >= 0 default - TABLE + expected_output = <<~TABLE.strip + Gem Current Latest Requested Groups + major 1.0.0 1.1.0 >= 0 default + minor 1.0.0 1.1.0 >= 0 default + TABLE - expect(out).to end_with(expected_output) - end + expect(out).to end_with(expected_output) + end - it "shows minor when updating to major and filtering to minor with parseable" do - bundle "outdated --major --filter-minor --parseable", :raise_on_error => false + it "shows minor when updating to major and filtering to minor with parseable" do + bundle "outdated --major --filter-minor --parseable", :raise_on_error => false - expect(out).not_to include("patch (newest") - expect(out).to include("minor (newest") - expect(out).not_to include("major (newest") - end + expect(out).not_to include("patch (newest") + expect(out).to include("minor (newest") + expect(out).not_to include("major (newest") end + end - context "with --strict" do - before do - build_repo4 do - build_gem "foo", %w[1.4.3 1.4.4] do |s| - s.add_dependency "bar", "~> 2.0" - end - build_gem "foo", %w[1.4.5 1.5.0] do |s| - s.add_dependency "bar", "~> 2.1" - end - build_gem "foo", %w[1.5.1] do |s| - s.add_dependency "bar", "~> 3.0" - end - build_gem "bar", %w[2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0] - build_gem "qux", %w[1.0.0 1.1.0 2.0.0] + context "tricky conservative updates" do + before do + build_repo4 do + build_gem "foo", %w[1.4.3 1.4.4] do |s| + s.add_dependency "bar", "~> 2.0" end + build_gem "foo", %w[1.4.5 1.5.0] do |s| + s.add_dependency "bar", "~> 2.1" + end + build_gem "foo", %w[1.5.1] do |s| + s.add_dependency "bar", "~> 3.0" + end + build_gem "bar", %w[2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 3.0.0] + build_gem "qux", %w[1.0.0 1.1.0 2.0.0] + end - # establish a lockfile set to 1.4.3 - install_gemfile <<-G - source "#{file_uri_for(gem_repo4)}" - gem 'foo', '1.4.3' - gem 'bar', '2.0.3' - gem 'qux', '1.0.0' - G + # establish a lockfile set to 1.4.3 + install_gemfile <<-G + source "#{file_uri_for(gem_repo4)}" + gem 'foo', '1.4.3' + gem 'bar', '2.0.3' + gem 'qux', '1.0.0' + G - # remove 1.4.3 requirement and bar altogether - # to setup update specs below - gemfile <<-G - source "#{file_uri_for(gem_repo4)}" - gem 'foo' - gem 'qux' - G - end + # remove 1.4.3 requirement and bar altogether + # to setup update specs below + gemfile <<-G + source "#{file_uri_for(gem_repo4)}" + gem 'foo' + gem 'qux' + G + end - it "shows gems with --strict updating to patch and filtering to patch" do - bundle "outdated --patch --strict --filter-patch", :raise_on_error => false + it "shows gems updating to patch and filtering to patch" do + bundle "outdated --patch --filter-patch", :raise_on_error => false, :env => { "DEBUG_RESOLVER" => "1" } - expected_output = <<~TABLE.strip - Gem Current Latest Requested Groups - bar 2.0.3 2.0.5 - foo 1.4.3 1.4.4 >= 0 default - TABLE + expected_output = <<~TABLE.strip + Gem Current Latest Requested Groups + bar 2.0.3 2.0.5 + foo 1.4.3 1.4.4 >= 0 default + TABLE - expect(out).to end_with(expected_output) - end + expect(out).to end_with(expected_output) + end - it "shows gems with --strict updating to patch and filtering to patch, in debug mode" do - bundle "outdated --patch --strict --filter-patch", :raise_on_error => false, :env => { "DEBUG" => "1" } + it "shows gems updating to patch and filtering to patch, in debug mode" do + bundle "outdated --patch --filter-patch", :raise_on_error => false, :env => { "DEBUG" => "1" } - expected_output = <<~TABLE.strip - Gem Current Latest Requested Groups Path - bar 2.0.3 2.0.5 - foo 1.4.3 1.4.4 >= 0 default - TABLE + expected_output = <<~TABLE.strip + Gem Current Latest Requested Groups Path + bar 2.0.3 2.0.5 + foo 1.4.3 1.4.4 >= 0 default + TABLE - expect(out).to end_with(expected_output) - end + expect(out).to end_with(expected_output) end end |