mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Fix conservative updates regardless of --strict
https://github.com/rubygems/rubygems/commit/c9a1d69a8d
This commit is contained in:
parent
71794a75db
commit
35c65e7ba6
2 changed files with 107 additions and 109 deletions
|
@ -46,7 +46,7 @@ module Bundler
|
|||
|
||||
Bundler::CLI::Common.configure_gem_version_promoter(
|
||||
Bundler.definition,
|
||||
options
|
||||
options.merge(:strict => @strict)
|
||||
)
|
||||
|
||||
definition_resolution = proc do
|
||||
|
|
|
@ -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
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
it "shows nothing when patching and filtering to minor" do
|
||||
bundle "outdated --patch --filter-minor"
|
||||
# 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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
expect(out).not_to include("patch (newest")
|
||||
expect(out).to include("minor (newest")
|
||||
expect(out).not_to include("major (newest")
|
||||
end
|
||||
# remove all version requirements
|
||||
gemfile <<-G
|
||||
source "#{file_uri_for(gem_repo4)}"
|
||||
gem 'patch'
|
||||
gem 'minor'
|
||||
gem 'major'
|
||||
G
|
||||
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]
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
it "shows gems with --strict updating to patch and filtering to patch" do
|
||||
bundle "outdated --patch --strict --filter-patch", :raise_on_error => false
|
||||
# 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
|
||||
|
||||
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
|
||||
# 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
|
||||
|
||||
expect(out).to end_with(expected_output)
|
||||
end
|
||||
it "shows gems updating to patch and filtering to patch" do
|
||||
bundle "outdated --patch --filter-patch", :raise_on_error => false, :env => { "DEBUG_RESOLVER" => "1" }
|
||||
|
||||
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" }
|
||||
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 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
|
||||
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
|
||||
|
||||
expect(out).to end_with(expected_output)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue