From ce9dcbea32e7212dc19d83bbb7a21afe8756ced0 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 7 Apr 2022 14:47:30 +0200 Subject: Fix failure when sending warning emails with custom text (#17983) * Add tests * Fix failure when sending warning emails with custom text --- spec/mailers/user_mailer_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'spec') diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index 9c866788f..2ed33c1e4 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -83,4 +83,15 @@ describe UserMailer, type: :mailer do include_examples 'localized subject', 'devise.mailer.email_changed.subject' 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 -- cgit