Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a failing test case for render :layout

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit 296007744525638b142501efee57faf6ac4be20f 1 parent 1024c11
@mikel mikel authored josevalim committed
View
15 actionmailer/test/base_test.rb
@@ -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
@@ -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
View
1  actionmailer/test/fixtures/base_mailer/different_layout.html.erb
@@ -0,0 +1 @@
+HTML
View
1  actionmailer/test/fixtures/base_mailer/different_layout.text.erb
@@ -0,0 +1 @@
+PLAIN
View
1  actionmailer/test/fixtures/base_mailer/email_custom_layout.text.html.erb
@@ -0,0 +1 @@
+body_text
View
1  actionmailer/test/fixtures/layouts/different_layout.html.erb
@@ -0,0 +1 @@
+HTML -- <%= yield %>
View
1  actionmailer/test/fixtures/layouts/different_layout.text.erb
@@ -0,0 +1 @@
+PLAIN -- <%= yield %>
Please sign in to comment.
Something went wrong with that request. Please try again.