diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-07-15 21:17:27 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2017-07-15 21:17:27 +0200 |
commit | aad42dce10a9cc110d67fa03a72ce5b41cbb394a (patch) | |
tree | 7c22623e9f34f2ff7bfa142385010b6a4e5aea85 /actionmailer/test | |
parent | 92fb8621a623afb33a145b1f3736010a3c870086 (diff) | |
parent | b6300f3ecc79bff29cf9bb804a30fd92403feac1 (diff) | |
download | rails-aad42dce10a9cc110d67fa03a72ce5b41cbb394a.tar.gz rails-aad42dce10a9cc110d67fa03a72ce5b41cbb394a.tar.bz2 rails-aad42dce10a9cc110d67fa03a72ce5b41cbb394a.zip |
Merge branch 'master' into unlock-minitest
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/base_test.rb | 4 | ||||
-rw-r--r-- | actionmailer/test/message_delivery_test.rb | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index af1c2f44a5..20d0dcfeb5 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -120,7 +120,7 @@ class BaseTest < ActiveSupport::TestCase email = BaseMailer.attachment_with_hash assert_equal(1, email.attachments.length) assert_equal("invoice.jpg", email.attachments[0].filename) - expected = "\312\213\254\232)b" + expected = "\312\213\254\232)b".dup expected.force_encoding(Encoding::BINARY) assert_equal expected, email.attachments["invoice.jpg"].decoded end @@ -129,7 +129,7 @@ class BaseTest < ActiveSupport::TestCase email = BaseMailer.attachment_with_hash_default_encoding assert_equal(1, email.attachments.length) assert_equal("invoice.jpg", email.attachments[0].filename) - expected = "\312\213\254\232)b" + expected = "\312\213\254\232)b".dup expected.force_encoding(Encoding::BINARY) assert_equal expected, email.attachments["invoice.jpg"].decoded end diff --git a/actionmailer/test/message_delivery_test.rb b/actionmailer/test/message_delivery_test.rb index c0683be94d..51f10b0bf1 100644 --- a/actionmailer/test/message_delivery_test.rb +++ b/actionmailer/test/message_delivery_test.rb @@ -95,6 +95,19 @@ class MessageDeliveryTest < ActiveSupport::TestCase end end + test "should enqueue the job with the correct delivery job" do + old_delivery_job = DelayedMailer.delivery_job + DelayedMailer.delivery_job = DummyJob + + assert_performed_with(job: DummyJob, args: ["DelayedMailer", "test_message", "deliver_now", 1, 2, 3]) do + @mail.deliver_later + end + + DelayedMailer.delivery_job = old_delivery_job + end + + class DummyJob < ActionMailer::DeliveryJob; 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) |