File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1358,8 +1358,18 @@ def test_errors_on_extremely_small_terminal_window
1358
1358
def test_errors_on_terminal_window_smaller_than_min_width
1359
1359
custom_max_width = 5
1360
1360
original_max_width = ErrorHighlight ::DefaultFormatter . max_snippet_width
1361
+ min_snippet_width = ErrorHighlight ::DefaultFormatter ::MIN_SNIPPET_WIDTH
1361
1362
1362
- ErrorHighlight ::DefaultFormatter . max_snippet_width = custom_max_width
1363
+ warning = nil
1364
+ original_warn = Warning . method ( :warn )
1365
+ Warning . define_singleton_method ( :warn ) { |s | warning = s }
1366
+ begin
1367
+ ErrorHighlight ::DefaultFormatter . max_snippet_width = custom_max_width
1368
+ ensure
1369
+ Warning . singleton_class . remove_method ( :warn )
1370
+ Warning . define_singleton_method ( :warn , original_warn )
1371
+ end
1372
+ assert_match "'max_snippet_width' adjusted to minimum value of #{ min_snippet_width } " , warning
1363
1373
1364
1374
assert_error_message ( NoMethodError , <<~END ) do
1365
1375
undefined method `time' for #{ ONE_RECV_MESSAGE }
You can’t perform that action at this time.
0 commit comments