File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -2490,6 +2490,12 @@ def idle_done
2490
2490
end
2491
2491
end
2492
2492
2493
+ RESPONSES_DEPRECATION_MSG =
2494
+ "Pass a type or block to #responses, " \
2495
+ "set config.responses_without_block to :silence_deprecation_warning, " \
2496
+ "or use #extract_responses or #clear_responses."
2497
+ private_constant :RESPONSES_DEPRECATION_MSG
2498
+
2493
2499
# :call-seq:
2494
2500
# responses {|hash| ...} -> block result
2495
2501
# responses(type) {|array| ...} -> block result
@@ -2584,10 +2590,9 @@ def responses(type = nil)
2584
2590
else
2585
2591
case config . responses_without_block
2586
2592
when :raise
2587
- raise ArgumentError , "Pass a block or use #clear_responses"
2593
+ raise ArgumentError , RESPONSES_DEPRECATION_MSG
2588
2594
when :warn
2589
- warn ( "DEPRECATED: pass a block or use #clear_responses" ,
2590
- uplevel : 1 , category : :deprecated )
2595
+ warn ( RESPONSES_DEPRECATION_MSG , uplevel : 1 , category : :deprecated )
2591
2596
end
2592
2597
@responses
2593
2598
end
Original file line number Diff line number Diff line change @@ -99,7 +99,14 @@ def for_each_config_option(imap)
99
99
end
100
100
101
101
def assert_responses_warn
102
- assert_warn ( /Pass a block.*or.*clear_responses/i ) do
102
+ assert_warn (
103
+ /
104
+ (?=(?-x)Pass a type or block to #responses\b )
105
+ (?=.*config\. responses_without_block.*:silence_deprecation_warning\b )
106
+ (?=.*\# extract_responses\b )
107
+ .*\# clear_responses\b
108
+ /ix
109
+ ) do
103
110
yield
104
111
end
105
112
end
You can’t perform that action at this time.
0 commit comments