diff --git a/test/color_test.rb b/test/color_test.rb index 497e7b118..cbb1e4f14 100644 --- a/test/color_test.rb +++ b/test/color_test.rb @@ -94,13 +94,12 @@ def test_colorize_does_not_color_string_if_do_not_use_colorize CONFIG[:no_color] = nil end + SESSION_class = Struct.new('SESSION') + private def stub_width_method - # When defining `Struct.new('SESSION')` directly under the class to solve - # `warning: redefining constant`, RR::Errors::DoubleNotFoundError occurred in - # testing of Github workflow. - DEBUGGER__.const_set('SESSION', Struct.new('SESSION')) + DEBUGGER__.const_set('SESSION', SESSION_class) stub(::DEBUGGER__::SESSION).width { IO.console_size[1] } end