mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
Add mailer subject tests and refine i18n keys (#910)
* Add mailer subject tests and refine i18n keys * Linter * Fix test * More fixes * More fixes --------- Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
@@ -8,7 +8,7 @@ class InvitationMailer < ApplicationMailer
|
||||
subject: t(
|
||||
".subject",
|
||||
inviter: @invitation.inviter.display_name,
|
||||
product: product_name
|
||||
product_name: product_name
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class PdfImportMailer < ApplicationMailer
|
||||
|
||||
mail(
|
||||
to: @user.email,
|
||||
subject: t(".subject", product: product_name)
|
||||
subject: t(".subject", product_name: product_name)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h1><%= t(".greeting", product: product_name) %></h1>
|
||||
<h1><%= t(".greeting", product_name: product_name) %></h1>
|
||||
|
||||
<p>
|
||||
<%= t(
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
en:
|
||||
pdf_import_mailer:
|
||||
next_steps:
|
||||
subject: "Your PDF document has been analyzed - %{product}"
|
||||
subject: "Your PDF document has been analyzed - %{product_name}"
|
||||
|
||||
18
test/mailers/invitation_mailer_test.rb
Normal file
18
test/mailers/invitation_mailer_test.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
require "test_helper"
|
||||
|
||||
class InvitationMailerTest < ActionMailer::TestCase
|
||||
test "invite_email" do
|
||||
invitation = invitations(:one)
|
||||
|
||||
mail = InvitationMailer.invite_email(invitation)
|
||||
|
||||
assert_equal I18n.t(
|
||||
"invitation_mailer.invite_email.subject",
|
||||
inviter: invitation.inviter.display_name,
|
||||
product_name: Rails.configuration.x.product_name
|
||||
), mail.subject
|
||||
assert_equal [ invitation.email ], mail.to
|
||||
assert_equal [ "hello@example.com" ], mail.from
|
||||
assert_match "accept", mail.body.encoded
|
||||
end
|
||||
end
|
||||
@@ -9,6 +9,10 @@ class PdfImportMailerTest < ActionMailer::TestCase
|
||||
test "next_steps email is sent to user" do
|
||||
mail = PdfImportMailer.with(user: @user, pdf_import: @pdf_import).next_steps
|
||||
|
||||
assert_equal I18n.t(
|
||||
"pdf_import_mailer.next_steps.subject",
|
||||
product_name: Rails.configuration.x.product_name
|
||||
), mail.subject
|
||||
assert_equal [ @user.email ], mail.to
|
||||
assert_includes mail.subject, "analyzed"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user