aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer/test')
-rw-r--r--actionmailer/test/base_test.rb26
-rw-r--r--actionmailer/test/fixtures/base_test/after_action_mailer/welcome.html.erb (renamed from actionmailer/test/fixtures/base_test/after_filter_mailer/welcome.html.erb)0
-rw-r--r--actionmailer/test/fixtures/base_test/before_action_mailer/welcome.html.erb (renamed from actionmailer/test/fixtures/base_test/before_filter_mailer/welcome.html.erb)0
-rw-r--r--actionmailer/test/mailers/base_mailer.rb5
4 files changed, 21 insertions, 10 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index 3c21886502..170923673b 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -505,6 +505,12 @@ class BaseTest < ActiveSupport::TestCase
mail.deliver
end
+ test 'the return value of mailer methods is not relevant' do
+ mail = BaseMailer.with_nil_as_return_value
+ assert_equal('Welcome', mail.body.to_s.strip)
+ mail.deliver
+ end
+
# Before and After hooks
class MyObserver
@@ -584,9 +590,9 @@ class BaseTest < ActiveSupport::TestCase
assert_equal("Thanks for signing up this afternoon", mail.subject)
end
- test "modifying the mail message with a before_filter" do
- class BeforeFilterMailer < ActionMailer::Base
- before_filter :add_special_header!
+ test "modifying the mail message with a before_action" do
+ class BeforeActionMailer < ActionMailer::Base
+ before_action :add_special_header!
def welcome ; mail ; end
@@ -596,12 +602,12 @@ class BaseTest < ActiveSupport::TestCase
end
end
- assert_equal('Wow, so special', BeforeFilterMailer.welcome['X-Special-Header'].to_s)
+ assert_equal('Wow, so special', BeforeActionMailer.welcome['X-Special-Header'].to_s)
end
- test "modifying the mail message with an after_filter" do
- class AfterFilterMailer < ActionMailer::Base
- after_filter :add_special_header!
+ test "modifying the mail message with an after_action" do
+ class AfterActionMailer < ActionMailer::Base
+ after_action :add_special_header!
def welcome ; mail ; end
@@ -611,12 +617,12 @@ class BaseTest < ActiveSupport::TestCase
end
end
- assert_equal('Testing', AfterFilterMailer.welcome['X-Special-Header'].to_s)
+ assert_equal('Testing', AfterActionMailer.welcome['X-Special-Header'].to_s)
end
- test "adding an inline attachment using a before_filter" do
+ test "adding an inline attachment using a before_action" do
class DefaultInlineAttachmentMailer < ActionMailer::Base
- before_filter :add_inline_attachment!
+ before_action :add_inline_attachment!
def welcome ; mail ; end
diff --git a/actionmailer/test/fixtures/base_test/after_filter_mailer/welcome.html.erb b/actionmailer/test/fixtures/base_test/after_action_mailer/welcome.html.erb
index e69de29bb2..e69de29bb2 100644
--- a/actionmailer/test/fixtures/base_test/after_filter_mailer/welcome.html.erb
+++ b/actionmailer/test/fixtures/base_test/after_action_mailer/welcome.html.erb
diff --git a/actionmailer/test/fixtures/base_test/before_filter_mailer/welcome.html.erb b/actionmailer/test/fixtures/base_test/before_action_mailer/welcome.html.erb
index e69de29bb2..e69de29bb2 100644
--- a/actionmailer/test/fixtures/base_test/before_filter_mailer/welcome.html.erb
+++ b/actionmailer/test/fixtures/base_test/before_action_mailer/welcome.html.erb
diff --git a/actionmailer/test/mailers/base_mailer.rb b/actionmailer/test/mailers/base_mailer.rb
index 52342bc59e..8fca6177bd 100644
--- a/actionmailer/test/mailers/base_mailer.rb
+++ b/actionmailer/test/mailers/base_mailer.rb
@@ -118,4 +118,9 @@ class BaseMailer < ActionMailer::Base
def without_mail_call
end
+
+ def with_nil_as_return_value(hash = {})
+ mail(:template_name => "welcome")
+ nil
+ end
end