Commit 6ab04f0ca90180ab1b7ec2a64f44cc05c33be243
1 parent
2df11dd7
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Fix task mailer content type for templates
Showing
2 changed files
with
3 additions
and
1 deletions
Show diff stats
app/mailers/task_mailer.rb
| ... | ... | @@ -40,7 +40,8 @@ class TaskMailer < ActionMailer::Base |
| 40 | 40 | to: task.requestor.notification_emails, |
| 41 | 41 | from: self.class.generate_from(task), |
| 42 | 42 | subject: @email_template.present? ? @email_template.parsed_subject(template_params) : '[%s] %s' % [task.requestor.environment.name, task.target_notification_description], |
| 43 | - body: @email_template.present? ? @email_template.parsed_body(template_params) : nil | |
| 43 | + body: @email_template.present? ? @email_template.parsed_body(template_params) : nil, | |
| 44 | + content_type: @email_template.present? ? "text/html" : nil | |
| 44 | 45 | ) |
| 45 | 46 | end |
| 46 | 47 | ... | ... |
test/unit/task_mailer_test.rb
| ... | ... | @@ -190,6 +190,7 @@ class TaskMailerTest < ActiveSupport::TestCase |
| 190 | 190 | task.send(:send_notification, :cancelled).deliver |
| 191 | 191 | assert !ActionMailer::Base.deliveries.empty? |
| 192 | 192 | mail = ActionMailer::Base.deliveries.last |
| 193 | + assert_match /text\/html/, mail.content_type | |
| 193 | 194 | assert_equal 'template subject - example', mail.subject.to_s |
| 194 | 195 | assert_equal 'template body - example - my name - explanation', mail.body.to_s |
| 195 | 196 | end | ... | ... |