aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-02-03 18:54:04 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-02-04 11:43:24 +0900
commit53b98f1ddabe5375ae92b014c41e2ef8a2606927 (patch)
tree162c7e9f7efb4e3b84395e6968ce61db7b6ef310 /actionmailer/test
parentd13bc5df902a2c82c3096b627830be97acbedf50 (diff)
downloadrails-53b98f1ddabe5375ae92b014c41e2ef8a2606927.tar.gz
rails-53b98f1ddabe5375ae92b014c41e2ef8a2606927.tar.bz2
rails-53b98f1ddabe5375ae92b014c41e2ef8a2606927.zip
Add `:args` to `process.action_mailer` event
Diffstat (limited to 'actionmailer/test')
-rw-r--r--actionmailer/test/base_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index 490aaf33fc..61960d411d 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -834,6 +834,25 @@ class BaseTest < ActiveSupport::TestCase
assert_equal "special indeed!", mail["X-Special-Header"].to_s
end
+ test "notification for process" do
+ begin
+ events = []
+ ActiveSupport::Notifications.subscribe("process.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 "process.action_mailer", events[0].name
+ assert_equal "BaseMailer", events[0].payload[:mailer]
+ assert_equal :welcome, events[0].payload[:action]
+ assert_equal [{ body: "Hello there" }], events[0].payload[:args]
+ ensure
+ ActiveSupport::Notifications.unsubscribe "process.action_mailer"
+ end
+ end
+
private
# Execute the block setting the given values and restoring old values after