mirror of https://github.com/rails/rails
Merge pull request #51619 from Earlopain/ruby-3.4-backtraces
Filter internal frames in deprecation warnings for Ruby 3.4
This commit is contained in:
commit
fa23f0fdd0
|
@ -172,7 +172,7 @@ module ActiveSupport
|
|||
LIB_DIR = RbConfig::CONFIG["libdir"]
|
||||
|
||||
def ignored_callstack?(path)
|
||||
path.start_with?(RAILS_GEM_ROOT, LIB_DIR)
|
||||
path.start_with?(RAILS_GEM_ROOT, LIB_DIR) || path.include?("<internal:")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -975,11 +975,22 @@ class DeprecationTest < ActiveSupport::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
test "warn deprecation can blame code from internal methods" do
|
||||
@deprecator.behavior = ->(message, *) { @message = message }
|
||||
method_that_emits_deprecation_with_internal_method(@deprecator)
|
||||
|
||||
assert_not_includes(@message, "internal")
|
||||
end
|
||||
|
||||
private
|
||||
def method_that_emits_deprecation(deprecator)
|
||||
deprecator.warn
|
||||
end
|
||||
|
||||
def method_that_emits_deprecation_with_internal_method(deprecator)
|
||||
[1].each { deprecator.warn }
|
||||
end
|
||||
|
||||
def with_rails_application_deprecators(&block)
|
||||
application = Struct.new(:deprecators).new(ActiveSupport::Deprecation::Deprecators.new)
|
||||
rails = Struct.new(:application).new(application)
|
||||
|
|
Loading…
Reference in New Issue