diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index 75df58c6bff..9310c3db288 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -210,6 +210,15 @@ RSpec.describe UserMailer do expect(mail.text_part.body) .to match(I18n.t('user_mailer.appeal_approved.title')) end + + context 'when user is missing' do + let(:mail) { described_class.appeal_approved(nil, appeal) } + + it 'handles missing value without sending' do + expect { mail.deliver } + .to_not send_email + end + end end describe '#appeal_rejected' do @@ -222,6 +231,15 @@ RSpec.describe UserMailer do expect(mail.text_part.body) .to match(I18n.t('user_mailer.appeal_rejected.title')) end + + context 'when user is missing' do + let(:mail) { described_class.appeal_rejected(nil, appeal) } + + it 'handles missing value without sending' do + expect { mail.deliver } + .to_not send_email + end + end end describe '#two_factor_enabled' do