mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-25 15:09:29 +00:00
User mailer spec coverage improvements (#23905)
This commit is contained in:
parent
42ddc45133
commit
7f4412eeeb
|
@ -17,7 +17,7 @@
|
||||||
%tbody
|
%tbody
|
||||||
%tr
|
%tr
|
||||||
%td
|
%td
|
||||||
= image_tag full_pack_url('media/images/mailer/icon_warning.png'), alt: ''
|
= image_tag full_pack_url('media/images/mailer/icon_flag.png'), alt: ''
|
||||||
|
|
||||||
%h1= t 'user_mailer.appeal_rejected.title'
|
%h1= t 'user_mailer.appeal_rejected.title'
|
||||||
|
|
||||||
|
|
|
@ -94,4 +94,52 @@ describe UserMailer, type: :mailer do
|
||||||
expect(mail.body.encoded).to include strike.text
|
expect(mail.body.encoded).to include strike.text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'webauthn_credential_deleted' do
|
||||||
|
let(:credential) { Fabricate(:webauthn_credential, user_id: receiver.id) }
|
||||||
|
let(:mail) { UserMailer.webauthn_credential_deleted(receiver, credential) }
|
||||||
|
|
||||||
|
it 'renders webauthn credential deleted notification' do
|
||||||
|
receiver.update!(locale: nil)
|
||||||
|
expect(mail.body.encoded).to include I18n.t('devise.mailer.webauthn_credential.deleted.title')
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples 'localized subject',
|
||||||
|
'devise.mailer.webauthn_credential.deleted.subject'
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'suspicious_sign_in' do
|
||||||
|
let(:ip) { '192.168.0.1' }
|
||||||
|
let(:agent) { 'NCSA_Mosaic/2.0 (Windows 3.1)' }
|
||||||
|
let(:timestamp) { Time.now.utc }
|
||||||
|
let(:mail) { UserMailer.suspicious_sign_in(receiver, ip, agent, timestamp) }
|
||||||
|
|
||||||
|
it 'renders suspicious sign in notification' do
|
||||||
|
receiver.update!(locale: nil)
|
||||||
|
expect(mail.body.encoded).to include I18n.t('user_mailer.suspicious_sign_in.explanation')
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples 'localized subject',
|
||||||
|
'user_mailer.suspicious_sign_in.subject'
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'appeal_approved' do
|
||||||
|
let(:appeal) { Fabricate(:appeal, account: receiver.account, approved_at: Time.now.utc) }
|
||||||
|
let(:mail) { UserMailer.appeal_approved(receiver, appeal) }
|
||||||
|
|
||||||
|
it 'renders appeal_approved notification' do
|
||||||
|
expect(mail.subject).to eq I18n.t('user_mailer.appeal_approved.subject', date: I18n.l(appeal.created_at))
|
||||||
|
expect(mail.body.encoded).to include I18n.t('user_mailer.appeal_approved.title')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'appeal_rejected' do
|
||||||
|
let(:appeal) { Fabricate(:appeal, account: receiver.account, rejected_at: Time.now.utc) }
|
||||||
|
let(:mail) { UserMailer.appeal_rejected(receiver, appeal) }
|
||||||
|
|
||||||
|
it 'renders appeal_rejected notification' do
|
||||||
|
expect(mail.subject).to eq I18n.t('user_mailer.appeal_rejected.subject', date: I18n.l(appeal.created_at))
|
||||||
|
expect(mail.body.encoded).to include I18n.t('user_mailer.appeal_rejected.title')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue