mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Failing AM test for nested layouts
This commit is contained in:
1
actionmailer/test/fixtures/nested/layouts/spam.html.erb
vendored
Normal file
1
actionmailer/test/fixtures/nested/layouts/spam.html.erb
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Nested Spammer layout <%= yield %>
|
||||
1
actionmailer/test/fixtures/nested_layout_mailer/signup.html.erb
vendored
Normal file
1
actionmailer/test/fixtures/nested_layout_mailer/signup.html.erb
vendored
Normal file
@@ -0,0 +1 @@
|
||||
We do not spam
|
||||
@@ -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 @@ class ExplicitLayoutMailer < ActionMailer::Base
|
||||
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 @@ class LayoutMailerTest < Test::Unit::TestCase
|
||||
# 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 @@ class LayoutMailerTest < Test::Unit::TestCase
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user