aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/test/mail_render_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer/test/mail_render_test.rb')
-rw-r--r--actionmailer/test/mail_render_test.rb37
1 files changed, 23 insertions, 14 deletions
diff --git a/actionmailer/test/mail_render_test.rb b/actionmailer/test/mail_render_test.rb
index 047ba0fb41..406aa0a116 100644
--- a/actionmailer/test/mail_render_test.rb
+++ b/actionmailer/test/mail_render_test.rb
@@ -40,13 +40,20 @@ class RenderMailer < ActionMailer::Base
from "tester@example.com"
end
- def included_old_subtemplate(recipient)
+ def mailer_accessor(recipient)
recipients recipient
- subject "Including another template in the one being rendered"
+ subject "Mailer Accessor"
from "tester@example.com"
- @world = "Earth"
- render :inline => "Hello, <%= render \"subtemplate\" %>"
+ render :inline => "Look, <%= mailer.subject %>!"
+ end
+
+ def no_instance_variable(recipient)
+ recipients recipient
+ subject "No Instance Variable"
+ from "tester@example.com"
+
+ render :inline => "Look, subject.nil? is <%= @subject.nil? %>!"
end
def initialize_defaults(method_name)
@@ -71,6 +78,8 @@ class SecondMailer < ActionMailer::Base
end
end
+# CHANGED: Those tests were changed because body returns an object now
+# Instead of mail.body.strip, we should mail.body.to_s.strip
class RenderHelperTest < Test::Unit::TestCase
def setup
set_delivery_method :test
@@ -86,38 +95,38 @@ class RenderHelperTest < Test::Unit::TestCase
def test_implicit_body
mail = RenderMailer.create_implicit_body(@recipient)
- # CHANGED: body returns an object now
- # assert_equal "Hello there, \n\nMr. test@localhost", mail.body.strip
assert_equal "Hello there, \n\nMr. test@localhost", mail.body.to_s.strip
end
def test_inline_template
mail = RenderMailer.create_inline_template(@recipient)
- # CHANGED: body returns an object now
- # assert_equal "Hello, Earth", mail.body.strip
assert_equal "Hello, Earth", mail.body.to_s.strip
end
def test_file_template
mail = RenderMailer.create_file_template(@recipient)
- # CHANGED: body returns an object now
- # assert_equal "Hello there, \n\nMr. test@localhost", mail.body.strip
assert_equal "Hello there, \n\nMr. test@localhost", mail.body.to_s.strip
end
def test_rxml_template
mail = RenderMailer.deliver_rxml_template(@recipient)
- # CHANGED: body returns an object now
- # assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test/>", mail.body.strip
assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test/>", mail.body.to_s.strip
end
def test_included_subtemplate
mail = RenderMailer.deliver_included_subtemplate(@recipient)
- # CHANGED: body returns an object now
- # assert_equal "Hey Ho, let's go!", mail.body.strip
assert_equal "Hey Ho, let's go!", mail.body.to_s.strip
end
+
+ def test_mailer_accessor
+ mail = RenderMailer.deliver_mailer_accessor(@recipient)
+ assert_equal "Look, Mailer Accessor!", mail.body.to_s.strip
+ end
+
+ def test_no_instance_variable
+ mail = RenderMailer.deliver_no_instance_variable(@recipient)
+ assert_equal "Look, subject.nil? is true!", mail.body.to_s.strip
+ end
end
class FirstSecondHelperTest < Test::Unit::TestCase