Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit f6aaa59

Browse files
committed
DEV: Patch Net::BufferedIO to help debug spec flakes
Internal `/t/154170`
1 parent 39653ae commit f6aaa59

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

spec/lib/completions/cancel_manager_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# frozen_string_literal: true
22

3+
# Debugging https://github.com/ruby/net-protocol/issues/32
4+
# which seems to be happening inconsistently in CI
5+
Net::BufferedIO.prepend(
6+
Module.new do
7+
def initialize(*args, **kwargs)
8+
puts "Initializing #{kwargs.inspect}"
9+
if kwargs[:debug_output] && !kwargs[:debug_output].respond_to(:<<)
10+
raise ArgumentError, "debug_output must support <<"
11+
end
12+
super
13+
end
14+
15+
def debug_output=(debug_output)
16+
puts "SETTING DEBUG OUTPUT: #{debug_output.inspect}"
17+
if debug_output && !debug_output.respond_to?(:<<)
18+
raise ArgumentError, "debug_output must support <<"
19+
end
20+
super
21+
end
22+
end,
23+
)
24+
325
describe DiscourseAi::Completions::CancelManager do
426
fab!(:model) { Fabricate(:anthropic_model, name: "test-model") }
527

0 commit comments

Comments
 (0)