From 7e44bde16c57b408f99269f928df80cba04682cc Mon Sep 17 00:00:00 2001 From: Nick Schwaderer Date: Mon, 12 Oct 2020 13:52:34 +0100 Subject: [PATCH] Ensures ActiveSupport is required When using the toolkit outside of Rails against MiniTest users will receive the following error: ``` deprecation_toolkit/lib/deprecation_toolkit.rb:20:in `add_notify_behavior': uninitialized constant ActiveSupport::Deprecation (NameError) ``` This will raise even when not using `ActiveSupport::Deprecation` (i.e. `warn 'Deprecated: this is my deprecation'`) as all deprecations are then passed through `ActiveSupport::Deprecation` in the gem. This PR requires the ActiveSupport dependency if not already defined to cover off these cases. Signed-off-by: Nick Schwaderer --- lib/deprecation_toolkit.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/deprecation_toolkit.rb b/lib/deprecation_toolkit.rb index 93bccf9..c23ae9c 100644 --- a/lib/deprecation_toolkit.rb +++ b/lib/deprecation_toolkit.rb @@ -34,8 +34,7 @@ def self.attach_subscriber end end -unless defined?(RSpec) - require "deprecation_toolkit/minitest_hook" -end +require "deprecation_toolkit/minitest_hook" unless defined? RSpec +require "active_support" unless defined? ActiveSupport::Deprecation require "deprecation_toolkit/warning"