Skip to content

Commit

Permalink
Failing AM test for nested layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jan 26, 2010
1 parent 52bb455 commit 9f71901
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions actionmailer/test/fixtures/nested/layouts/spam.html.erb
@@ -0,0 +1 @@
Nested Spammer layout <%= yield %>
@@ -0,0 +1 @@
We do not spam
19 changes: 17 additions & 2 deletions 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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 9f71901

Please sign in to comment.