# Rake will likely end, causing the in-process thread pool to be deleted, before
# any/all of the .deliver_later emails are processed
def self.with_synched_deliveries(&block)
- adapter = ActionMailer::DeliveryJob.queue_adapter
+ adapter = ActionMailer::MailDeliveryJob.queue_adapter
if adapter.is_a?(ActiveJob::QueueAdapters::AsyncAdapter)
- ActionMailer::DeliveryJob.queue_adapter = ActiveJob::QueueAdapters::InlineAdapter.new
+ ActionMailer::MailDeliveryJob.queue_adapter = ActiveJob::QueueAdapters::InlineAdapter.new
end
yield
ensure
- ActionMailer::DeliveryJob.queue_adapter = adapter
+ ActionMailer::MailDeliveryJob.queue_adapter = adapter
end
def mail(headers={}, &block)
config.active_record.store_full_sti_class = true
config.active_record.default_timezone = :local
+ config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
["Rails version", Rails::VERSION::STRING],
["Environment", Rails.env],
["Database adapter", ActiveRecord::Base.connection.adapter_name],
- ["Mailer queue", ActionMailer::DeliveryJob.queue_adapter.class.name],
+ ["Mailer queue", ActionMailer::MailDeliveryJob.queue_adapter.class.name],
["Mailer delivery", ActionMailer::Base.delivery_method]
].map {|info| " %-30s %s" % info}.join("\n") + "\n"
end
def test_with_synched_deliveries_should_yield_with_synced_deliveries
- ActionMailer::DeliveryJob.queue_adapter = ActiveJob::QueueAdapters::AsyncAdapter.new
+ ActionMailer::MailDeliveryJob.queue_adapter = ActiveJob::QueueAdapters::AsyncAdapter.new
Mailer.with_synched_deliveries do
- assert_kind_of ActiveJob::QueueAdapters::InlineAdapter, ActionMailer::DeliveryJob.queue_adapter
+ assert_kind_of ActiveJob::QueueAdapters::InlineAdapter, ActionMailer::MailDeliveryJob.queue_adapter
end
- assert_kind_of ActiveJob::QueueAdapters::AsyncAdapter, ActionMailer::DeliveryJob.queue_adapter
+ assert_kind_of ActiveJob::QueueAdapters::AsyncAdapter, ActionMailer::MailDeliveryJob.queue_adapter
ensure
- ActionMailer::DeliveryJob.queue_adapter = ActiveJob::QueueAdapters::InlineAdapter.new
+ ActionMailer::MailDeliveryJob.queue_adapter = ActiveJob::QueueAdapters::InlineAdapter.new
end
def test_email_addresses_should_keep_addresses