Fix failure when sending warning emails with custom text (#17983)

* Add tests

* Fix failure when sending warning emails with custom text
This commit is contained in:
Claire 2022-04-07 14:47:30 +02:00 committed by GitHub
parent 8c03b45fff
commit ce9dcbea32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -7,6 +7,7 @@ class UserMailer < Devise::Mailer
helper :application helper :application
helper :instance helper :instance
helper :statuses helper :statuses
helper :formatting
helper RoutingHelper helper RoutingHelper

View File

@ -83,4 +83,15 @@ describe UserMailer, type: :mailer do
include_examples 'localized subject', include_examples 'localized subject',
'devise.mailer.email_changed.subject' 'devise.mailer.email_changed.subject'
end end
describe 'warning' do
let(:strike) { Fabricate(:account_warning, target_account: receiver.account, text: 'dont worry its just the testsuite', action: 'suspend') }
let(:mail) { UserMailer.warning(receiver, strike) }
it 'renders warning notification' do
receiver.update!(locale: nil)
expect(mail.body.encoded).to include I18n.t("user_mailer.warning.title.suspend", acct: receiver.account.acct)
expect(mail.body.encoded).to include strike.text
end
end
end end