title: ActionMailer sending real emails in test mode! - How to turn off?
body: <p>Newly signed up users to my little app must be approved by the admin (me) before they can gain access to the site.  I've succeeded in generating such emails in development with an <code>after_create :send_admin_email</code> in my user model which works great.  My problem is that I'm  generating multiple users during my tests (using FactoryGirl) and each test user created  sends off a real email.  Running my tests is like pouring molasses in January and I've got to delete hundreds of emails sent to my inbox.  How do I turn that off?</p>
  
  <p><a href="http://guides.rubyonrails.org/action_mailer_basics.html" rel="nofollow noreferrer">Action Mailer Basics</a> in the <a href="http://guides.rubyonrails.org/index.html" rel="nofollow noreferrer">Rails Guides</a> tells me that "By default Action Mailer does not send emails in the test environment. They are just added to the ActionMailer::Base.deliveries array."</p>
  
  <p>Moreover, in <code>config/environments/test.rb</code> I've got:</p>
  
  <pre><code>config.action_mailer.delivery_method = :test
  </code></pre>
  
  <p>That's in addition to in <code>config/environment.rb</code> having:</p>
  
  <pre><code># Configuration for using SendGrid on Heroku
  ActionMailer::Base.smtp_settings = {
    :address        =&gt; 'smtp.sendgrid.net',
    :port           =&gt; '587',
    :authentication =&gt; :plain,
    :user_name      =&gt; 'app[my app number]@heroku.com',
    :password       =&gt; '[something super secret]',
    :domain         =&gt; '[let's get this party started!.com]',
    :enable_starttls_auto =&gt; true
  }
  ActionMailer::Base.delivery_method = :smtp
  </code></pre>
  
  <p>I'm sure that I'm missing something simple and basic.  I've searched around and related questions and posts deal with how to test that ActionMailer actually sent email.</p>
  
  <p>Humble gratitude in advance for any thoughts or help.</p>
  
  <p>Addendum:  Following answer to similar question found at <a href="https://stackoverflow.com/questions/10609113/is-it-possible-to-turn-off-actionmailer-emails-when-cucumber-testing-is-happenin">Is it possible to turn off ActionMailer emails when cucumber testing is happening on development?</a> I was able to stop the email sending madness.  Still, I had to add <code>ActionMailer::Base.delivery_method = :test</code> to several rspec files.  Is there a way I can shut this down globally?  Anyone have any thoughts on what's going on?</p>