From 89b21717e1121c79428362ceb73dd2c9de903d61 Mon Sep 17 00:00:00 2001 From: Alessandro Rodi Date: Sun, 18 Feb 2024 18:04:14 +0100 Subject: [PATCH] Fix missing host in email title (#4461) * Add a mailer test --- app/mailers/mailer.rb | 2 +- test/mailers/mailer_test.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/mailers/mailer_test.rb diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index fb59eefd5d5..e4d93155f95 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -20,7 +20,7 @@ def email_reset(user) def email_reset_update(user) @user = user mail to: @user.email, - subject: I18n.t("mailer.email_reset_update.subject") + subject: I18n.t("mailer.email_reset_update.subject", host: Gemcutter::HOST_DISPLAY) end def email_confirmation(user) diff --git a/test/mailers/mailer_test.rb b/test/mailers/mailer_test.rb new file mode 100644 index 00000000000..2aa1c920042 --- /dev/null +++ b/test/mailers/mailer_test.rb @@ -0,0 +1,17 @@ +require "test_helper" + +class MailerTest < ActionMailer::TestCase + setup do + @user = create(:user) + end + + context "#email_reset_update" do + should "include host in subject" do + email = Mailer.email_reset_update(@user) + + assert_emails(1) { email.deliver_now } + + assert_includes email.subject, Gemcutter::HOST_DISPLAY + end + end +end