I'm receiving real emails when I run my tests with RSpec. I've made everything as it was written in this question (I've add change my environment config to do not send emails, but it no make any effect at all. I'm thinking that my setting are replaced somewhere but I can't find where.
Here is my config for test env (config/enviroments/test.rb)
Myapp::Application.configure do
config.action_mailer.delivery_method = :test
config.action_mailer.perform_deliveries = false
end
here are my mailers:
class ApplicationMailer < ActionMailer::Base
default from: 'hello@myapp.com'
layout 'mailer'
ADMIN_EMAIL = 'admin@myapp.com'
end
class AdminMailer < ApplicationMailer
default to: "#{ADMIN_EMAIL}"
def mandrill_client
@mandrill_client ||= Mandrill::API.new MANDRILL_API_KEY
end
def new_user(user)
#set required params
mandrill_client.messages.send_template template_name, template_content, message
end
end
It seems that I've missed something very obvious. However I need your help in breaking it up.