diff --git a/activejob/lib/active_job/railtie.rb b/activejob/lib/active_job/railtie.rb index 2f6d351b99..3064a591e7 100644 --- a/activejob/lib/active_job/railtie.rb +++ b/activejob/lib/active_job/railtie.rb @@ -13,23 +13,28 @@ module ActiveJob ActiveSupport.on_load(:active_job) { self.logger = ::Rails.logger } end - initializer "active_job.set_configs" do - config.after_initialize do |app| - options = app.config.active_job - options.queue_adapter ||= :async - - custom_serializers = options.delete(:custom_serializers) + initializer "active_job.custom_serializers" do |app| + config.after_initialize do + custom_serializers = app.config.active_job.delete(:custom_serializers) ActiveJob::Serializers.add_serializers custom_serializers + end + end - ActiveSupport.on_load(:active_job) do - options.each { |k, v| send("#{k}=", v) } - end + initializer "active_job.set_configs" do |app| + options = app.config.active_job + options.queue_adapter ||= :async - ActiveSupport.on_load(:action_dispatch_integration_test) do - include ActiveJob::TestHelper + ActiveSupport.on_load(:active_job) do + options.each do |k, v| + k = "#{k}=" + send(k, v) if respond_to? k end end + ActiveSupport.on_load(:action_dispatch_integration_test) do + include ActiveJob::TestHelper + end + ActiveSupport.on_load(:active_record) do self.destroy_association_async_job = ActiveRecord::DestroyAssociationAsyncJob end diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 0b7d080428..eb7671b87b 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -2379,17 +2379,6 @@ module ApplicationTests assert_equal "async", ActionView::Helpers::AssetTagHelper.image_decoding end - test "raises when unknown configuration option is set for ActiveJob" do - add_to_config <<-RUBY - config.active_job.unknown = "test" - RUBY - - assert_raise(NoMethodError) do - app "development" - ActiveJob::Base # load active_job - end - end - test "ActiveJob::Base.retry_jitter is 0.15 by default for new apps" do app "development"