1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #39472

Closes #39472.
This commit is contained in:
Rafael Mendonça França 2020-12-01 00:40:52 +00:00
commit a173a65730
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
2 changed files with 22 additions and 16 deletions

View file

@ -13,26 +13,21 @@ module ActiveJob
ActiveSupport.on_load(:active_job) { self.logger = ::Rails.logger }
end
initializer "active_job.custom_serializers" do |app|
config.after_initialize do
custom_serializers = app.config.active_job.delete(:custom_serializers)
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)
ActiveJob::Serializers.add_serializers custom_serializers
end
end
initializer "active_job.set_configs" do |app|
options = app.config.active_job
options.queue_adapter ||= :async
ActiveSupport.on_load(:active_job) do
options.each do |k, v|
k = "#{k}="
send(k, v) if respond_to? k
ActiveSupport.on_load(:active_job) do
options.each { |k, v| send("#{k}=", v) }
end
end
ActiveSupport.on_load(:action_dispatch_integration_test) do
include ActiveJob::TestHelper
ActiveSupport.on_load(:action_dispatch_integration_test) do
include ActiveJob::TestHelper
end
end
ActiveSupport.on_load(:active_record) do

View file

@ -2322,6 +2322,17 @@ module ApplicationTests
assert_equal true, ActionView::Helpers::FormTagHelper.default_enforce_utf8
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"