From b7351354315560ca641b4cbfbb601f4196a98fe2 Mon Sep 17 00:00:00 2001 From: Jordan Brough Date: Wed, 23 Mar 2022 09:16:28 -0600 Subject: [PATCH] chore: Fix "action_mailer.delivery_method" in the test env (#4257) Fixes: #4247 --- config/initializers/mailer.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/initializers/mailer.rb b/config/initializers/mailer.rb index 54a22f0dc..5c317d62f 100644 --- a/config/initializers/mailer.rb +++ b/config/initializers/mailer.rb @@ -3,7 +3,6 @@ Rails.application.configure do # Configuration Related to Action Mailer ######################################### - config.action_mailer.delivery_method = :smtp # We need the application frontend url to be used in our emails config.action_mailer.default_url_options = { host: ENV['FRONTEND_URL'] } if ENV['FRONTEND_URL'].present? # We load certain mailer templates from our database. This ensures changes to it is reflected immediately @@ -26,7 +25,7 @@ Rails.application.configure do smtp_settings[:ssl] = ActiveModel::Type::Boolean.new.cast(ENV.fetch('SMTP_SSL', true)) if ENV['SMTP_SSL'] smtp_settings[:tls] = ActiveModel::Type::Boolean.new.cast(ENV.fetch('SMTP_TLS', true)) if ENV['SMTP_TLS'] - config.action_mailer.delivery_method = :smtp + config.action_mailer.delivery_method = :smtp unless Rails.env.test? config.action_mailer.smtp_settings = smtp_settings # You can use letter opener for your local development by setting the environment variable config.action_mailer.delivery_method = :letter_opener if Rails.env.development? && ENV['LETTER_OPENER']