method
assert_enqueued_email_with
v5.2.3 -
Show latest stable
- Class:
ActionMailer::TestHelper
assert_enqueued_email_with(mailer, method, args: nil, queue: "mailers", &block)public
Asserts that block should cause the specified email to be enqueued.
def test_email_in_block assert_enqueued_email_with ContactMailer, :welcome do ContactMailer.welcome.deliver_later end end
If args is provided as a Hash, a parameterized email is matched.
def test_parameterized_email assert_enqueued_email_with ContactMailer, :welcome, args: {email: 'user@example.com} do ContactMailer.with(email: 'user@example.com').welcome.deliver_later end end