Add ActionText.deprecator

This commit adds `ActionText.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:16:54 -05:00
parent f434310b3b
commit b2bc006815
4 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,8 @@
require "active_support"
require "active_support/rails"
require "action_text/deprecator"
require "nokogiri"
module ActionText

View File

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

View File

@ -19,6 +19,10 @@ module ActionText
#{root}/app/models
)
initializer "action_text.deprecator" do |app|
app.deprecators[:action_text] = ActionText.deprecator
end
initializer "action_text.attribute" do
ActiveSupport.on_load(:active_record) do
include ActionText::Attribute

View File

@ -3895,6 +3895,7 @@ module ApplicationTests
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 ActionText.deprecator, Rails.application.deprecators[:action_text]
assert_equal ActionView.deprecator, Rails.application.deprecators[:action_view]
assert_equal ActiveJob.deprecator, Rails.application.deprecators[:active_job]
assert_equal ActiveRecord.deprecator, Rails.application.deprecators[:active_record]