Add ActionMailbox.deprecator

This commit adds `ActionMailbox.deprecator`, and adds it to
`Rails.application.deprecators` so that it can be configured via
settings such as `config.active_support.report_deprecations`.
This commit is contained in:
Jonathan Hefner 2022-11-01 15:06:07 -05:00
parent 5a4eadd51c
commit f434310b3b
4 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
# frozen_string_literal: true
require "action_mailbox/deprecator"
require "action_mailbox/mail_ext"
module ActionMailbox

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
module ActionMailbox
def self.deprecator # :nodoc:
@deprecator ||= ActiveSupport::Deprecation.new
end
end

View File

@ -22,6 +22,10 @@ module ActionMailbox
config.action_mailbox.storage_service = nil
initializer "action_mailbox.deprecator" do |app|
app.deprecators[:action_mailbox] = ActionMailbox.deprecator
end
initializer "action_mailbox.config" do
config.after_initialize do |app|
ActionMailbox.logger = app.config.action_mailbox.logger || Rails.logger

View File

@ -3893,6 +3893,7 @@ module ApplicationTests
assert_equal AbstractController.deprecator, Rails.application.deprecators[:action_controller]
assert_equal ActionController.deprecator, Rails.application.deprecators[:action_controller]
assert_equal ActionDispatch.deprecator, Rails.application.deprecators[:action_dispatch]
assert_equal ActionMailbox.deprecator, Rails.application.deprecators[:action_mailbox]
assert_equal ActionMailer.deprecator, Rails.application.deprecators[:action_mailer]
assert_equal ActionView.deprecator, Rails.application.deprecators[:action_view]
assert_equal ActiveJob.deprecator, Rails.application.deprecators[:active_job]