title: Test fails when sending email: An SMTP To address is required to send a message. Set the message smtp_envelope_to, to, cc, or bcc address
body: <p>I have an after_create callback for the User model that will send an email to the admin so that he can approve the account. It works perfectly in development mode but when I run my Capybara/RSpec tests, it fails with the following exception:</p>
  
  <pre><code>ArgumentError:
     An SMTP To address is required to send a message. Set the message smtp_envelope_to, to, cc, or bcc address.
  </code></pre>
  
  <p>I do have have config.action_mailer.delivery_method set to :test in config/environments/test.rb. Why does it attempt to use SMTP while it is in the test environment? And why does this happen for only this email delivery (which is in the model) but not with other deliveries (using devise gem)?</p>
  
  <p>Here is a snippet from the User model:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    after_create :send_admin_mail
  protected
  
    def send_admin_mail
      puts ActionMailer::Base.delivery_method  #prints test!
      ReviewMailer.new_user_waiting_for_approval(self).deliver
    end
  end
  </code></pre>