From c90c6c1344e62d5705f92efc323016a83a1e7351 Mon Sep 17 00:00:00 2001 From: Luke Pearce <30228+kule@users.noreply.github.com> Date: Fri, 5 Oct 2018 16:53:28 +0100 Subject: Parameterized mailers can configure delivery job Setting parameterized_delivery_job on a mailer class will cause Parameterized::MessageDelivery to use the specified job instead of ActionMailer::Parameterized::DeliveryJob: class MyMailer < ApplicationMailer self.parameterized_delivery_job = MyCustomDeliveryJob ... end --- actionmailer/test/parameterized_test.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'actionmailer/test/parameterized_test.rb') diff --git a/actionmailer/test/parameterized_test.rb b/actionmailer/test/parameterized_test.rb index ec6c5e9e67..d3b34fc3e3 100644 --- a/actionmailer/test/parameterized_test.rb +++ b/actionmailer/test/parameterized_test.rb @@ -53,4 +53,17 @@ class ParameterizedTest < ActiveSupport::TestCase invitation = mailer.method(:anything) end end + + test "should enqueue a parameterized request with the correct delivery job" do + old_delivery_job = ParamsMailer.parameterized_delivery_job + ParamsMailer.parameterized_delivery_job = ParameterizedDummyJob + + assert_performed_with(job: ParameterizedDummyJob, args: ["ParamsMailer", "invitation", "deliver_now", { inviter: "david@basecamp.com", invitee: "jason@basecamp.com" } ]) do + @mail.deliver_later + end + + ParamsMailer.parameterized_delivery_job = old_delivery_job + end + + class ParameterizedDummyJob < ActionMailer::Parameterized::DeliveryJob; end end -- cgit v1.2.3