about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-04-07 14:47:30 +0200
committerGitHub <noreply@github.com>2022-04-07 14:47:30 +0200
commitce9dcbea32e7212dc19d83bbb7a21afe8756ced0 (patch)
tree2888245139162973aa5bb97a63b950e36914d4c2
parent8c03b45fffc54a66d1c9c3eec75a7c6f741d0947 (diff)
Fix failure when sending warning emails with custom text (#17983)
* Add tests

* Fix failure when sending warning emails with custom text
-rw-r--r--app/mailers/user_mailer.rb1
-rw-r--r--spec/mailers/user_mailer_spec.rb11
2 files changed, 12 insertions, 0 deletions
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index ce36dd6f5..e47bedec6 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -7,6 +7,7 @@ class UserMailer < Devise::Mailer
   helper :application
   helper :instance
   helper :statuses
+  helper :formatting
 
   helper RoutingHelper
 
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