Skip to content

Commit

Permalink
template_name and template_path should not be added to mail headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Apr 13, 2010
1 parent 518891f commit b4fd5e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion actionmailer/lib/action_mailer/base.rb
Expand Up @@ -541,7 +541,7 @@ def mail(headers={}, &block)
wrap_delivery_behavior!(headers.delete(:delivery_method))

# Assign all headers except parts_order, content_type and body
assignable = headers.except(:parts_order, :content_type, :body)
assignable = headers.except(:parts_order, :content_type, :body, :template_name, :template_path)
assignable.each { |k, v| m[k] = v }

# Render the templates and blocks
Expand Down
10 changes: 5 additions & 5 deletions actionmailer/test/base_test.rb
Expand Up @@ -510,28 +510,28 @@ def different_layout(layout_name='')

# Rendering
test "you can specify a different template for implicit render" do
mail = BaseMailer.implicit_different_template('implicit_multipart')
mail = BaseMailer.implicit_different_template('implicit_multipart').deliver
assert_equal("HTML Implicit Multipart", mail.html_part.body.decoded)
assert_equal("TEXT Implicit Multipart", mail.text_part.body.decoded)
end

test "you can specify a different template for explicit render" do
mail = BaseMailer.explicit_different_template('explicit_multipart_templates')
mail = BaseMailer.explicit_different_template('explicit_multipart_templates').deliver
assert_equal("HTML Explicit Multipart Templates", mail.html_part.body.decoded)
assert_equal("TEXT Explicit Multipart Templates", mail.text_part.body.decoded)
end

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

test "you can specify the template path for implicit lookup" do
mail = BaseMailer.welcome_from_another_path('another.path/base_mailer')
mail = BaseMailer.welcome_from_another_path('another.path/base_mailer').deliver
assert_equal("Welcome from another path", mail.body.encoded)

mail = BaseMailer.welcome_from_another_path(['unknown/invalid', 'another.path/base_mailer'])
mail = BaseMailer.welcome_from_another_path(['unknown/invalid', 'another.path/base_mailer']).deliver
assert_equal("Welcome from another path", mail.body.encoded)
end

Expand Down

0 comments on commit b4fd5e6

Please sign in to comment.