mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
commit
a173a65730
2 changed files with 22 additions and 16 deletions
|
@ -13,27 +13,22 @@ module ActiveJob
|
||||||
ActiveSupport.on_load(:active_job) { self.logger = ::Rails.logger }
|
ActiveSupport.on_load(:active_job) { self.logger = ::Rails.logger }
|
||||||
end
|
end
|
||||||
|
|
||||||
initializer "active_job.custom_serializers" do |app|
|
initializer "active_job.set_configs" do
|
||||||
config.after_initialize do
|
config.after_initialize do |app|
|
||||||
custom_serializers = app.config.active_job.delete(:custom_serializers)
|
|
||||||
ActiveJob::Serializers.add_serializers custom_serializers
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
initializer "active_job.set_configs" do |app|
|
|
||||||
options = app.config.active_job
|
options = app.config.active_job
|
||||||
options.queue_adapter ||= :async
|
options.queue_adapter ||= :async
|
||||||
|
|
||||||
|
custom_serializers = options.delete(:custom_serializers)
|
||||||
|
ActiveJob::Serializers.add_serializers custom_serializers
|
||||||
|
|
||||||
ActiveSupport.on_load(:active_job) do
|
ActiveSupport.on_load(:active_job) do
|
||||||
options.each do |k, v|
|
options.each { |k, v| send("#{k}=", v) }
|
||||||
k = "#{k}="
|
|
||||||
send(k, v) if respond_to? k
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
ActiveSupport.on_load(:action_dispatch_integration_test) do
|
ActiveSupport.on_load(:action_dispatch_integration_test) do
|
||||||
include ActiveJob::TestHelper
|
include ActiveJob::TestHelper
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
ActiveSupport.on_load(:active_record) do
|
ActiveSupport.on_load(:active_record) do
|
||||||
self.destroy_association_async_job = ActiveRecord::DestroyAssociationAsyncJob
|
self.destroy_association_async_job = ActiveRecord::DestroyAssociationAsyncJob
|
||||||
|
|
|
@ -2322,6 +2322,17 @@ module ApplicationTests
|
||||||
assert_equal true, ActionView::Helpers::FormTagHelper.default_enforce_utf8
|
assert_equal true, ActionView::Helpers::FormTagHelper.default_enforce_utf8
|
||||||
end
|
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
|
test "ActiveJob::Base.retry_jitter is 0.15 by default for new apps" do
|
||||||
app "development"
|
app "development"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue