Skip to content

Commit

Permalink
Add a failing test case for render :layout
Browse files Browse the repository at this point in the history
Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
mikel authored and josevalim committed Jan 29, 2010
1 parent 1024c11 commit 2960077
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions actionmailer/test/base_test.rb
Expand Up @@ -86,6 +86,15 @@ def different_template(template_name='')
end
end

def different_layout(layout_name='')
mail do |format|
format.text {
render :layout => layout_name
}
format.html { render :layout => layout_name }
end
end

end

test "method call to mail does not raise error" do
Expand Down Expand Up @@ -469,6 +478,12 @@ def different_template(template_name='')
assert_equal("TEXT Explicit Multipart Templates", mail.text_part.body.decoded)
end

test "that you can specify a different layout" do
mail = BaseMailer.different_layout('different_layout')
assert_equal("HTML -- HTML", mail.html_part.body.decoded)
assert_equal("PLAIN -- PLAIN", mail.text_part.body.decoded)
end

protected

# Execute the block setting the given values and restoring old values after
Expand Down
@@ -0,0 +1 @@
HTML
@@ -0,0 +1 @@
PLAIN
@@ -0,0 +1 @@
body_text
@@ -0,0 +1 @@
HTML -- <%= yield %>
@@ -0,0 +1 @@
PLAIN -- <%= yield %>

0 comments on commit 2960077

Please sign in to comment.