I can't figure out how to get the syntax to work for asserting that an email has been enqueued properly. Specifically, how do you pass in the arguments to the mailer when the argument is an object?
For example, if you want to pass in a contact object to the example from the documentation:
assert_enqueued_email_with ContactMailer, :welcome, @contact do
ContactMailer.welcome(@contact).deliver_later
end
assert_enqueued_email_with ContactMailer, :welcome, args: @contact do
ContactMailer.welcome.deliver_later
end
assert_enqueued_email_with ContactMailer, :welcome, [@contact] do
ContactMailer.welcome.deliver_later
end
None of these appear to work. If you look at the actual enqueued job, the object looks like this:
{:job=>ActionMailer::DeliveryJob, :args=>["ContactMailer", "welcome", "deliver_now", {"_aj_globalid"=>"gid://app_name/Contact/1015983224"}], :queue=>"mailers"}
Any help is appreciated!