diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-06-03 13:25:32 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-06-03 13:25:32 -0300 |
commit | cecbf9ed32ab19d34ecae278f247a552d853b329 (patch) | |
tree | 00785309704d9df03c02ecd5041854c98fed2761 /actionmailer/test | |
parent | 6c4416183454cc75ee4dbed107fe7370c69fc37d (diff) | |
parent | f5a131aaeaf0533e5f81461c2ad63474a865c19c (diff) | |
download | rails-cecbf9ed32ab19d34ecae278f247a552d853b329.tar.gz rails-cecbf9ed32ab19d34ecae278f247a552d853b329.tar.bz2 rails-cecbf9ed32ab19d34ecae278f247a552d853b329.zip |
Merge pull request #18587 from chrismcg/allow_deliver_later_queue_name_to_be_configured
Allow configuration of ActionMailer queue name
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/message_delivery_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/actionmailer/test/message_delivery_test.rb b/actionmailer/test/message_delivery_test.rb index aaa3f218b5..862ce26187 100644 --- a/actionmailer/test/message_delivery_test.rb +++ b/actionmailer/test/message_delivery_test.rb @@ -9,6 +9,8 @@ class MessageDeliveryTest < ActiveSupport::TestCase setup do @previous_logger = ActiveJob::Base.logger @previous_delivery_method = ActionMailer::Base.delivery_method + @previous_deliver_later_queue_name = ActionMailer::Base.deliver_later_queue_name + ActionMailer::Base.deliver_later_queue_name = :test_queue ActionMailer::Base.delivery_method = :test ActiveJob::Base.logger = Logger.new(nil) @mail = DelayedMailer.test_message(1, 2, 3) @@ -20,6 +22,7 @@ class MessageDeliveryTest < ActiveSupport::TestCase teardown do ActiveJob::Base.logger = @previous_logger ActionMailer::Base.delivery_method = @previous_delivery_method + ActionMailer::Base.deliver_later_queue_name = @previous_deliver_later_queue_name end test 'should have a message' do @@ -80,4 +83,15 @@ class MessageDeliveryTest < ActiveSupport::TestCase end end + test 'should enqueue the job on the correct queue' do + assert_performed_with(job: ActionMailer::DeliveryJob, args: ['DelayedMailer', 'test_message', 'deliver_now', 1, 2, 3], queue: "test_queue") do + @mail.deliver_later + end + end + + test 'can override the queue when enqueuing mail' do + assert_performed_with(job: ActionMailer::DeliveryJob, args: ['DelayedMailer', 'test_message', 'deliver_now', 1, 2, 3], queue: "another_queue") do + @mail.deliver_later(queue: :another_queue) + end + end end |