module ThoughtBot::Shoulda::ActionMailer::Assertions

def assert_sent_email


'none@none.com' as one of the recipients.
Passes if there is an email with subject containing 'hi there' and

end
email.subject =~ /hi there/ && email.to.include?('none@none.com')
assert_sent_email do |email|

Passes if ActionMailer::Base.deliveries has an email

assert_sent_email

narrow down the types of emails you're expecting.
Asserts that an email was delivered. Can take a block that can further
def assert_sent_email
  emails = ::ActionMailer::Base.deliveries
  assert !emails.empty?, "No emails were sent"
  if block_given?
    matching_emails = emails.select {|email| yield email }
    assert !matching_emails.empty?, "None of the emails matched."
  end
end