Commit 3af4c864653297ff2796f6d5ddf1836e6906fd9b
1 parent
2c762593
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Fix email template content type
Showing
2 changed files
with
6 additions
and
3 deletions
Show diff stats
app/helpers/email_template_helper.rb
1 | 1 | module EmailTemplateHelper |
2 | 2 | |
3 | 3 | def mail_with_template(params={}) |
4 | - params[:body] = params[:email_template].present? ? params[:email_template].parsed_body(params[:template_params]) : params[:body] | |
5 | - params[:subject] = params[:email_template].present? ? params[:email_template].parsed_subject(params[:template_params]) : params[:subject] | |
4 | + if params[:email_template].present? | |
5 | + params[:body] = params[:email_template].parsed_body(params[:template_params]) | |
6 | + params[:subject] = params[:email_template].parsed_subject(params[:template_params]) | |
7 | + params[:content_type] = "text/html" | |
8 | + end | |
6 | 9 | mail(params.except(:email_template)) |
7 | 10 | end |
8 | 11 | ... | ... |
test/unit/email_template_helper_test.rb
... | ... | @@ -7,7 +7,7 @@ class EmailTemplateHelperTest < ActionView::TestCase |
7 | 7 | template.expects(:parsed_body).returns('parsed body') |
8 | 8 | template.expects(:parsed_subject).returns('parsed subject') |
9 | 9 | params = {:subject => 'subject', :body => 'body', :email_template => template} |
10 | - expects(:mail).with({:subject => 'parsed subject', :body => 'parsed body'}) | |
10 | + expects(:mail).with({:subject => 'parsed subject', :body => 'parsed body', :content_type => 'text/html'}) | |
11 | 11 | mail_with_template(params) |
12 | 12 | end |
13 | 13 | ... | ... |