[rubygems/rubygems] Preserve the previous behavior of raising an error when in frozen mode

https://github.com/rubygems/rubygems/commit/6e35a6edfe
This commit is contained in:
David Rodríguez 2022-07-30 10:07:45 +02:00 committed by git
parent bc90090672
commit 3e4fedca4e
2 changed files with 57 additions and 40 deletions

View File

@ -108,7 +108,11 @@ module Bundler
(spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
end
if search.nil? && Bundler.frozen_bundle?
search = candidates.last
else
search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
end
search
end
end

View File

@ -241,7 +241,8 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(the_bundle).to include_gems("rack 1.2")
end
it "automatically updates lockfile to use the older version" do
context "when there is a lockfile using the newer incompatible version" do
before do
build_repo2 do
build_gem "parallel_tests", "3.7.0" do |s|
s.required_ruby_version = ">= #{current_ruby_minor}"
@ -272,7 +273,9 @@ RSpec.describe "bundle install with install-time dependencies" do
BUNDLED WITH
#{Bundler::VERSION}
L
end
it "automatically updates lockfile to use the older version" do
bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
expect(lockfile).to eq <<~L
@ -292,6 +295,16 @@ RSpec.describe "bundle install with install-time dependencies" do
L
end
it "gives a meaningful error if we're in frozen mode" do
expect do
bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s, "BUNDLE_FROZEN" => "true" }, :raise_on_error => false
end.not_to change { lockfile }
expect(err).to include("parallel_tests-3.8.0 requires ruby version >= #{next_ruby_minor}")
expect(err).not_to include("That means the author of parallel_tests (3.8.0) has removed it.")
end
end
it "gives a meaningful error on ruby version mismatches between dependencies" do
build_repo4 do
build_gem "requires-old-ruby" do |s|