DEV: Patch Net::BufferedIO to help debug spec flakes (#1375)

Internal `/t/154170`
This commit is contained in:
David Taylor 2025-05-28 10:24:07 +01:00 committed by GitHub
parent 39653aed22
commit ca78b1a1c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,25 @@
# frozen_string_literal: true
# Debugging https://github.com/ruby/net-protocol/issues/32
# which seems to be happening inconsistently in CI
Net::BufferedIO.prepend(
Module.new do
def initialize(*args, **kwargs)
if kwargs[:debug_output] && !kwargs[:debug_output].respond_to(:<<)
raise ArgumentError, "debug_output must support <<"
end
super
end
def debug_output=(debug_output)
if debug_output && !debug_output.respond_to?(:<<)
raise ArgumentError, "debug_output must support <<"
end
super
end
end,
)
describe DiscourseAi::Completions::CancelManager do
fab!(:model) { Fabricate(:anthropic_model, name: "test-model") }