[ruby/rubygems] Cover cooldown outdated annotation and update error path

Adds three E2E checks against the v2 cooldown artifice: the negative
CLI value is rejected at parse time, `bundle outdated --cooldown` tags
the latest-but-cooled version in both table and parseable output, and
`bundle update --cooldown 99999` surfaces the cooldown hint when every
candidate is filtered. These were the remaining coverage gaps called
out in the adversarial review.

https://github.com/ruby/rubygems/commit/3df6b300f7

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Hiroshi SHIBATAandClaude Opus 4.7 authored and git committed 2026-06-02 04:29:47 +00:00
1 parent 5e7d68f99e
commit 325228e2b8
1 file changed
+88
+88
View File
@@ -44,6 +44,12 @@ RSpec.describe "bundle install with the cooldown setting" do
expect(the_bundle).to include_gems("myrack 1.0.0")
end
it "rejects a negative --cooldown value" do
bundle "install --cooldown=-7", artifice: "compact_index", raise_on_error: false
expect(err).to match(/non-negative integer/)
end
end
context "configuration" do
@@ -154,5 +160,87 @@ RSpec.describe "bundle install with the cooldown setting" do
expect(the_bundle).to include_gems("ripe_gem 2.0.0")
end
it "annotates in-cooldown versions in bundle outdated table output" do
gemfile <<-G
source "https://gem.repo3"
gem "ripe_gem", "1.0.0"
G
lockfile <<-L
GEM
remote: https://gem.repo3/
specs:
ripe_gem (1.0.0)
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
ripe_gem (= 1.0.0)
BUNDLED WITH
#{Bundler::VERSION}
L
bundle "outdated --cooldown 7", artifice: "compact_index_cooldown", raise_on_error: false
expect(out).to match(/ripe_gem.*\(cooldown \d+d\)/)
end
it "annotates in-cooldown versions in bundle outdated --parseable output" do
gemfile <<-G
source "https://gem.repo3"
gem "ripe_gem", "1.0.0"
G
lockfile <<-L
GEM
remote: https://gem.repo3/
specs:
ripe_gem (1.0.0)
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
ripe_gem (= 1.0.0)
BUNDLED WITH
#{Bundler::VERSION}
L
bundle "outdated --cooldown 7 --parseable", artifice: "compact_index_cooldown", raise_on_error: false
expect(out).to match(/ripe_gem.*in cooldown for \d+ more day/)
end
it "surfaces a cooldown hint when bundle update filters every candidate" do
gemfile <<-G
source "https://gem.repo3"
gem "ripe_gem"
G
lockfile <<-L
GEM
remote: https://gem.repo3/
specs:
ripe_gem (1.0.0)
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
ripe_gem
BUNDLED WITH
#{Bundler::VERSION}
L
bundle "update ripe_gem --cooldown 99999", artifice: "compact_index_cooldown", raise_on_error: false
expect(err).to match(/excluded by the cooldown setting/)
expect(err).to match(/--cooldown 0/)
end
end
end