From 4df9cc29c15634de8de5912d2b40766f04e58c03 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sun, 26 Jan 2014 12:03:32 +0000 Subject: Support underscored symbols in Action Mailer config We allow the use of underscored symbols to represent classes throughout other parts of Rails so it seems incongruous that it's not supported in `register_interceptor` and `register_observer`. --- actionmailer/test/base_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'actionmailer/test') diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index 454e1afe97..02707d0b5f 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -530,6 +530,13 @@ class BaseTest < ActiveSupport::TestCase mail.deliver end + test "you can register an observer using its symbolized underscored name to the mail object that gets informed on email delivery" do + ActionMailer::Base.register_observer(:"base_test/my_observer") + mail = BaseMailer.welcome + MyObserver.expects(:delivered_email).with(mail) + mail.deliver + end + test "you can register multiple observers to the mail object that both get informed on email delivery" do ActionMailer::Base.register_observers("BaseTest::MyObserver", MySecondObserver) mail = BaseMailer.welcome @@ -568,6 +575,13 @@ class BaseTest < ActiveSupport::TestCase mail.deliver end + test "you can register an interceptor using its symbolized underscored name to the mail object that gets passed the mail object before delivery" do + ActionMailer::Base.register_interceptor(:"base_test/my_interceptor") + mail = BaseMailer.welcome + MyInterceptor.expects(:delivering_email).with(mail) + mail.deliver + end + test "you can register multiple interceptors to the mail object that both get passed the mail object before delivery" do ActionMailer::Base.register_interceptors("BaseTest::MyInterceptor", MySecondInterceptor) mail = BaseMailer.welcome -- cgit v1.2.3