Hey there,
is the new approach SomeMailer.with( some: 'params').nice_email(recipient).deliver_now
meant to be combined?
It makes sense to me, if you want to send out multiple emails, to initiate the Mailer with more generic parameters and then send args as specific arguments.
But when I used the integrated testing method assert_enqueued_email_with
I can only use one or the other.
I would suggest to allow both and change:
def assert_enqueued_email_with(mailer, method, args: nil, queue: ActionMailer::Base.deliver_later_queue_name || "default", &block)
args = if args.is_a?(Hash)
[mailer.to_s, method.to_s, "deliver_now", params: args, args: []]
else
[mailer.to_s, method.to_s, "deliver_now", args: Array(args)]
end
assert_enqueued_with(job: mailer.delivery_job, args: args, queue: queue.to_s, &block)
end
to
def assert_enqueued_email_with2(mailer, method, args: nil, params: nil,
queue: ActionMailer::Base.deliver_later_queue_name || 'default', &block)
args = if params.is_a?(Hash)
[mailer.to_s, method.to_s, "deliver_now", params: params, args: args || []]
else
[mailer.to_s, method.to_s, "deliver_now", args: Array(args)]
end
assert_enqueued_with(job: mailer.delivery_job, args: args, queue: queue.to_s, &block)
end
best