module Shoulda::ActionMailer::Matchers
def have_sent_email
with_body(/spam/).
from('do-not-reply@example.com').
it { should have_sent_email.with_subject(/spam/).
it { should have_sent_email.to('myself@me.com') }
it { should have_sent_email.with_body(/is spam\./) }
it { should have_sent_email.from('do-not-reply@example.com') }
it { should have_sent_email.with_subject(/is spam$/) }
The right email is sent.
def have_sent_email HaveSentEmailMatcher.new end