summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2026-05-07 19:08:26 +0900
committergit <svn-admin@ruby-lang.org>2026-05-08 06:43:43 +0000
commit3a93bdcbbdd5b52877fa62205fc69f050848d8b8 (patch)
tree5ee07bd2079856ac6dfc94fffd5514e20401eb99
parent3e1a5faa1a7c02aa2ac8dd07dc98b74c55c130e4 (diff)
[ruby/rubygems] Cover install-time compatibility for metadata overrides
Drive bundle install end-to-end with a gem whose required_ruby_version or required_rubygems_version excludes the current runtime, asserting that a per-gem override (and an :all override) makes the install succeed instead of erroring at the install-time compatibility gate. https://github.com/ruby/rubygems/commit/dbc9f24269 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
-rw-r--r--spec/bundler/install/gemfile/override_spec.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/bundler/install/gemfile/override_spec.rb b/spec/bundler/install/gemfile/override_spec.rb
index 64fd9d0442..54dd031853 100644
--- a/spec/bundler/install/gemfile/override_spec.rb
+++ b/spec/bundler/install/gemfile/override_spec.rb
@@ -317,4 +317,58 @@ RSpec.describe "override DSL" do
expect(lockfile).to include("selectable (2.0)")
end
end
+
+ context "install-time compatibility" do
+ it "installs a gem whose required_ruby_version excludes the current Ruby when an override removes the constraint" do
+ build_repo2 do
+ build_gem "needs_old_ruby", "1.0" do |s|
+ s.required_ruby_version = "< #{Gem.ruby_version}"
+ end
+ end
+
+ install_gemfile <<-G
+ source "https://gem.repo2"
+ override "needs_old_ruby", required_ruby_version: nil
+ gem "needs_old_ruby"
+ G
+
+ expect(the_bundle).to include_gems "needs_old_ruby 1.0"
+ end
+
+ it "installs a gem whose required_rubygems_version excludes the current RubyGems when an override removes it" do
+ build_repo2 do
+ build_gem "needs_old_rubygems", "1.0" do |s|
+ s.required_rubygems_version = "< #{Gem.rubygems_version}"
+ end
+ end
+
+ install_gemfile <<-G
+ source "https://gem.repo2"
+ override "needs_old_rubygems", required_rubygems_version: nil
+ gem "needs_old_rubygems"
+ G
+
+ expect(the_bundle).to include_gems "needs_old_rubygems 1.0"
+ end
+
+ it "installs every gem when :all required_ruby_version override is in effect" do
+ build_repo2 do
+ build_gem "needs_old_ruby_a", "1.0" do |s|
+ s.required_ruby_version = "< #{Gem.ruby_version}"
+ end
+ build_gem "needs_old_ruby_b", "1.0" do |s|
+ s.required_ruby_version = "< #{Gem.ruby_version}"
+ end
+ end
+
+ install_gemfile <<-G
+ source "https://gem.repo2"
+ override :all, required_ruby_version: :ignore_upper
+ gem "needs_old_ruby_a"
+ gem "needs_old_ruby_b"
+ G
+
+ expect(the_bundle).to include_gems "needs_old_ruby_a 1.0", "needs_old_ruby_b 1.0"
+ end
+ end
end