From 509095356feb7e330074ce622a2b525babbf5a32 Mon Sep 17 00:00:00 2001 From: Christian Rimondi Date: Thu, 24 Oct 2024 13:16:06 +0200 Subject: [PATCH] Use original callstack in the DeprecationsDetector::Collect class --- lib/deprecations_detector/collect.rb | 2 +- spec/faked_project/lib/faked_project/some_class.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/deprecations_detector/collect.rb b/lib/deprecations_detector/collect.rb index fb38d79..8da8765 100644 --- a/lib/deprecations_detector/collect.rb +++ b/lib/deprecations_detector/collect.rb @@ -3,7 +3,7 @@ module DeprecationsDetector class Collect def self.call(message = "", callstack = [], deprecation_horizon = nil, gem_name = nil) - DeprecationsDetector::Main.add_deprecation(message, caller) + DeprecationsDetector::Main.add_deprecation(message, callstack.map(&:to_s)) end def self.arity diff --git a/spec/faked_project/lib/faked_project/some_class.rb b/spec/faked_project/lib/faked_project/some_class.rb index 1819935..5cb4019 100644 --- a/spec/faked_project/lib/faked_project/some_class.rb +++ b/spec/faked_project/lib/faked_project/some_class.rb @@ -9,6 +9,10 @@ def initialize(label) end def reverse + deprecated_reverse + end + + def deprecated_reverse deprecator = ActiveSupport::Deprecation.new deprecator.behavior = DeprecationsDetector::Collect deprecator.warn('My Deprecation')