method
capture_emails
v7.2.3 -
Show latest stable
- Class:
ActionMailer::TestHelper
capture_emails(&block)public
Returns any emails that are sent in the block.
def test_emails emails = capture_emails do ContactMailer.welcome.deliver_now end assert_equal "Hi there", emails.first.subject emails = capture_emails do ContactMailer.welcome.deliver_now ContactMailer.welcome.deliver_later end assert_equal "Hi there", emails.first.subject end