Shopify/deprecation_toolkit

DeprecationToolkit adds private methods in the Minitest module - should we avoid that?

rmacklin opened this issue · 2 comments

These two methods:

def add_notify_behavior
notify = ActiveSupport::Deprecation::DEFAULT_BEHAVIORS[:notify]
behaviors = ActiveSupport::Deprecation.behavior
unless behaviors.find { |behavior| behavior == notify }
ActiveSupport::Deprecation.behavior = behaviors << notify
end
end
def attach_subscriber
DeprecationToolkit::Configuration.attach_to.each do |gem_name|
DeprecationToolkit::DeprecationSubscriber.attach_to gem_name
end
end

are defined inside the Minitest module. However, the methods themselves are independent. It seems safer to define them inside the DeprecationToolkit namespace, to keep this gem isolated from potential conflicts with other gems that could redefine Minitest#add_notify_behavior and Minitest#attach_subscriber.

If you agree, I'd be happy to open a PR.

That sounds reasonable to me 👍

Ok, I opened #23