### Home Classes Methods

### In Files

- lib/shoulda/action_mailer/matchers.rb
- lib/shoulda/action_mailer/matchers/have_sent_email.rb

### Methods

- #have_sent_email

### Files

- CONTRIBUTION_GUIDELINES.rdoc
- README.rdoc

### Class/Module Index

Quicksearch

- Shoulda
- Shoulda::ActionController
- Shoulda::ActionController::Macros
- Shoulda::ActionController::Matchers
- Shoulda::ActionMailer
- Shoulda::ActionMailer::Assertions
- Shoulda::ActionMailer::Matchers
- Shoulda::ActiveRecord
- Shoulda::ActiveRecord::Assertions
- Shoulda::ActiveRecord::Helpers
- Shoulda::ActiveRecord::Macros
- Shoulda::ActiveRecord::Matchers
- Shoulda::Assertions
- Shoulda::ClassMethods
- Shoulda::Helpers
- Shoulda::InstanceMethods
- Shoulda::Macros
- ActionController
- Test

No matching classes.

# Shoulda::ActionMailer::Matchers

# Matchers for your mailers

This matcher will test that email is sent properly

    describe User do
      it { should have_sent_email.with_subject(/is spam$/) }
      it { should have_sent_email.from('do-not-reply@example.com') }
      it { should have_sent_email.with_body(/is spam\./) }
      it { should have_sent_email.to('myself@me.com') }
      it { should have_sent_email.with_subject(/spam/).
                                  from('do-not-reply@example.com').
                                  with_body(/spam/).
                                  to('myself@me.com') }
    end

### Public Instance Methods

have_sent_email() click to toggle source

The right email is sent.

    it { should have_sent_email.with_subject(/is spam$/) }
    it { should have_sent_email.from('do-not-reply@example.com') }
    it { should have_sent_email.with_body(/is spam\./) }
    it { should have_sent_email.to('myself@me.com') }
    it { should have_sent_email.with_subject(/spam/).
                                from('do-not-reply@example.com').
                                with_body(/spam/).
                                to('myself@me.com') }

    # File lib/shoulda/action_mailer/matchers/have_sent_email.rb, line 15
    def have_sent_email
      HaveSentEmailMatcher.new
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.