aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/base_test.rb
diff options
context:
space:
mode:
authorJaap van der Plas <jvdplas@gmail.com>2019-02-13 15:55:38 +0100
committerGeorge Claghorn <george.claghorn@gmail.com>2019-02-13 09:55:38 -0500
commit2488901da8a4d896003254869a378f0c1b4ed3f2 (patch)
tree6911e103fef3a6e87f9274b3f8bde75417c232a6 /actionmailer/test/base_test.rb
parent47e3bbeb9057b37c244330cc4e745c8a8090e8c5 (diff)
downloadrails-2488901da8a4d896003254869a378f0c1b4ed3f2.tar.gz
rails-2488901da8a4d896003254869a378f0c1b4ed3f2.tar.bz2
rails-2488901da8a4d896003254869a378f0c1b4ed3f2.zip
Don’t log recipients when sending mail
Since production applications typically run with log level info and email adresses should be considered as sensitive data we want to prevent them from ending up in the logs. In development mode (with log level debug) they are still logged as part of the Mail::Message object.
Diffstat (limited to 'actionmailer/test/base_test.rb')
-rw-r--r--actionmailer/test/base_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index d0c4f189fd..15613d4dce 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -913,6 +913,23 @@ class BaseTest < ActiveSupport::TestCase
ActiveSupport::Notifications.unsubscribe "process.action_mailer"
end
+ test "notification for deliver" do
+ begin
+ events = []
+ ActiveSupport::Notifications.subscribe("deliver.action_mailer") do |*args|
+ events << ActiveSupport::Notifications::Event.new(*args)
+ end
+
+ BaseMailer.welcome(body: "Hello there").deliver_now
+
+ assert_equal 1, events.length
+ assert_equal "deliver.action_mailer", events[0].name
+ assert_not_nil events[0].payload[:message_id]
+ ensure
+ ActiveSupport::Notifications.unsubscribe "deliver.action_mailer"
+ end
+ end
+
private
# Execute the block setting the given values and restoring old values after