Skip to content

Commit

Permalink
Ensures ActiveSupport is required
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Nick Schwaderer committed Oct 21, 2020
1 parent 1f2d656 commit cf85ffa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/deprecation_toolkit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

require "deprecation_toolkit/warning"

0 comments on commit cf85ffa

Please sign in to comment.