File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
lib/active_support/deprecation Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,12 @@ def extract_callstack(callstack)
151
151
end
152
152
153
153
def _extract_callstack ( callstack )
154
- warn "Please pass `caller_locations` to the deprecation API" if $VERBOSE
154
+ ActiveSupport . deprecator . warn ( <<~MESSAGE )
155
+ Passing the result of `caller` to ActiveSupport::Deprecation#warn is deprecated and will be removed in Rails 7.2.
156
+
157
+ Please pass the result of `caller_locations` instead.
158
+ MESSAGE
159
+
155
160
offending_line = callstack . find { |line | !ignored_callstack? ( line ) } || callstack . first
156
161
157
162
if offending_line
Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ def setup
39
39
end
40
40
end
41
41
42
+ test "passing callstack as `caller` is deprecated" do
43
+ assert_deprecated ( /Passing the result of `caller` to ActiveSupport::Deprecation#warn/ , ActiveSupport . deprecator ) do
44
+ assert_deprecated ( @deprecator ) do
45
+ @deprecator . warn ( "Yo dawg!" , caller )
46
+ end
47
+ end
48
+ end
49
+
42
50
test "assert_deprecated is deprecated without a deprecator" do
43
51
assert_deprecated ( ActiveSupport . deprecator ) do
44
52
assert_deprecated do
You can’t perform that action at this time.
0 commit comments