I have a controller action that enqueues the delivery of an email. I wrote a test for that controller action and I've been getting a deprecation warning when I run the tests:
DEPRECATION WARNING: Sending mail with DeliveryJob and Parameterized::DeliveryJob is deprecated and will be removed in Rails 6.1. Please use MailDeliveryJob instead.
controller:
def send_email
SubscriptionMailer.with(user_id: @user.id).send_welcome_email.deliver_later
end
SubscriptionMailer:
class SubscriptionMailer < ApplicationMailer
helper :auxiliaries
before_action { @user = User.find_by(id: params[:user_id]) }
def send_welcome_email
@base_email = find_base_email_or_raise("welcome_email")
@subject = "#{@user.fname} #{@base_email.subject}"
send_email(subject: @subject)
end
end
test:
test "#send_email should enqueue SubscriptionMailer's #send_welcome_email" do
assert_emails 1 do
get send_email_admin_subscriptions_activation_path(
@user.id,
)
end
end
How do I upgrade my App to get rid of the warnings?
I've read about uncommenting a line in new_framework_defaults_6_0.rb in different posts but that didn't resolve the issue.