]> cat aescling's git repositories - mastodon.git/commitdiff
Fix failure when sending warning emails with custom text (#17983)
authorClaire <claire.github-309c@sitedethib.com>
Thu, 7 Apr 2022 12:47:30 +0000 (14:47 +0200)
committerGitHub <noreply@github.com>
Thu, 7 Apr 2022 12:47:30 +0000 (14:47 +0200)
* Add tests

* Fix failure when sending warning emails with custom text

app/mailers/user_mailer.rb
spec/mailers/user_mailer_spec.rb

index ce36dd6f5f715ec763a7d56fcb93ae13a1eb5f22..e47bedec6b9c104c78784af55490bb5ec6b9564a 100644 (file)
@@ -7,6 +7,7 @@ class UserMailer < Devise::Mailer
   helper :application
   helper :instance
   helper :statuses
+  helper :formatting
 
   helper RoutingHelper
 
index 9c866788f204b833f076f8843a3b260cbefbe953..2ed33c1e4ad1f77cf40d24c5203276eb30a22a58 100644 (file)
@@ -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