diff options
Diffstat (limited to 'actionmailer')
-rw-r--r-- | actionmailer/lib/action_mailer.rb | 2 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/delivery_job.rb (renamed from actionmailer/lib/action_mailer/delayed_delivery_job.rb) | 4 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/message_delivery.rb | 4 | ||||
-rw-r--r-- | actionmailer/test/message_delivery_test.rb | 8 |
4 files changed, 10 insertions, 8 deletions
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index 1add881054..b994ef3182 100644 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -46,5 +46,5 @@ module ActionMailer autoload :TestCase autoload :TestHelper autoload :MessageDelivery - autoload :DelayedDeliveryJob + autoload :DeliveryJob end diff --git a/actionmailer/lib/action_mailer/delayed_delivery_job.rb b/actionmailer/lib/action_mailer/delivery_job.rb index 159198829f..b2cfa245fd 100644 --- a/actionmailer/lib/action_mailer/delayed_delivery_job.rb +++ b/actionmailer/lib/action_mailer/delivery_job.rb @@ -1,11 +1,11 @@ require 'active_job' module ActionMailer - class DelayedDeliveryJob < ActiveJob::Base + class DeliveryJob < ActiveJob::Base queue_as :mailers def perform(mailer, mail_method, delivery_method, *args) - mailer.constantize.send(mail_method, *args).send(delivery_method) + mailer.constantize.public_send(mail_method, *args).send(delivery_method) end end end diff --git a/actionmailer/lib/action_mailer/message_delivery.rb b/actionmailer/lib/action_mailer/message_delivery.rb index 27e0671427..80a0517bff 100644 --- a/actionmailer/lib/action_mailer/message_delivery.rb +++ b/actionmailer/lib/action_mailer/message_delivery.rb @@ -1,3 +1,5 @@ +require 'delegate' + module ActionMailer class MessageDelivery < Delegator def initialize(mailer, mail_method, *args) @@ -37,7 +39,7 @@ module ActionMailer enqueue_method = :enqueue_in args.unshift options[:in] end - ActionMailer::DelayedDeliveryJob.send enqueue_method, *args + ActionMailer::DeliveryJob.send enqueue_method, *args end end end diff --git a/actionmailer/test/message_delivery_test.rb b/actionmailer/test/message_delivery_test.rb index 49958081f5..a097d0e84d 100644 --- a/actionmailer/test/message_delivery_test.rb +++ b/actionmailer/test/message_delivery_test.rb @@ -51,21 +51,21 @@ class MessageDeliveryTest < ActiveSupport::TestCase end test 'should enqueue the email with :deliver delivery method' do - ret = ActionMailer::DelayedDeliveryJob.stub :enqueue, ->(*args){ args } do + ret = ActionMailer::DeliveryJob.stub :enqueue, ->(*args){ args } do @mail.deliver_later end assert_equal ['DelayedMailer', 'test_message', 'deliver', 1, 2, 3], ret end test 'should enqueue the email with :deliver! delivery method' do - ret = ActionMailer::DelayedDeliveryJob.stub :enqueue, ->(*args){ args } do + ret = ActionMailer::DeliveryJob.stub :enqueue, ->(*args){ args } do @mail.deliver_later! end assert_equal ['DelayedMailer', 'test_message', 'deliver!', 1, 2, 3], ret end test 'should enqueue a delivery with a delay' do - ret = ActionMailer::DelayedDeliveryJob.stub :enqueue_in, ->(*args){ args } do + ret = ActionMailer::DeliveryJob.stub :enqueue_in, ->(*args){ args } do @mail.deliver_later in: 600 end assert_equal [600, 'DelayedMailer', 'test_message', 'deliver', 1, 2, 3], ret @@ -73,7 +73,7 @@ class MessageDeliveryTest < ActiveSupport::TestCase test 'should enqueue a delivery at a specific time' do later_time = Time.now.to_i + 3600 - ret = ActionMailer::DelayedDeliveryJob.stub :enqueue_at, ->(*args){ args } do + ret = ActionMailer::DeliveryJob.stub :enqueue_at, ->(*args){ args } do @mail.deliver_later at: later_time end assert_equal [later_time, 'DelayedMailer', 'test_message', 'deliver', 1, 2, 3], ret |