From 9f7190187cd755345557009a0b0ca9eec679b415 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 26 Jan 2010 09:27:21 -0600 Subject: [PATCH] Failing AM test for nested layouts --- .../fixtures/nested/layouts/spam.html.erb | 1 + .../nested_layout_mailer/signup.html.erb | 1 + .../test/old_base/mail_layout_test.rb | 19 +++++++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 actionmailer/test/fixtures/nested/layouts/spam.html.erb create mode 100644 actionmailer/test/fixtures/nested_layout_mailer/signup.html.erb diff --git a/actionmailer/test/fixtures/nested/layouts/spam.html.erb b/actionmailer/test/fixtures/nested/layouts/spam.html.erb new file mode 100644 index 0000000000000..7a24b19b7f753 --- /dev/null +++ b/actionmailer/test/fixtures/nested/layouts/spam.html.erb @@ -0,0 +1 @@ +Nested Spammer layout <%= yield %> \ No newline at end of file diff --git a/actionmailer/test/fixtures/nested_layout_mailer/signup.html.erb b/actionmailer/test/fixtures/nested_layout_mailer/signup.html.erb new file mode 100644 index 0000000000000..4789e888c624f --- /dev/null +++ b/actionmailer/test/fixtures/nested_layout_mailer/signup.html.erb @@ -0,0 +1 @@ +We do not spam \ No newline at end of file diff --git a/actionmailer/test/old_base/mail_layout_test.rb b/actionmailer/test/old_base/mail_layout_test.rb index 4038fbf339923..2abd3ece92127 100644 --- a/actionmailer/test/old_base/mail_layout_test.rb +++ b/actionmailer/test/old_base/mail_layout_test.rb @@ -1,7 +1,7 @@ require 'abstract_unit' class AutoLayoutMailer < ActionMailer::Base - + def hello recipients 'test@localhost' subject "You have a mail" @@ -51,6 +51,16 @@ def logout end end +class NestedLayoutMailer < ActionMailer::Base + layout 'nested/layouts/spam' + + def signup + recipients 'test@localhost' + subject "You have a mail" + from "tester@example.com" + end +end + class LayoutMailerTest < Test::Unit::TestCase def setup set_delivery_method :test @@ -77,7 +87,7 @@ def test_should_pickup_multipart_layout # CHANGED: content_type returns an object # assert_equal 'text/plain', mail.parts.first.content_type assert_equal 'text/plain', mail.parts.first.mime_type - + # CHANGED: body returns an object # assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body assert_equal "text/plain layout - text/plain multipart", mail.parts.first.body.to_s @@ -145,4 +155,9 @@ def test_explicit_layout_exceptions mail = ExplicitLayoutMailer.logout assert_equal "You logged out", mail.body.to_s.strip end + + def test_nested_class_layout + mail = NestedLayoutMailer.signup + assert_equal "Nested Spammer layout We do not spam", mail.body.to_s.strip + end end