mailers: ignore more SMTP errors
Although we already ignore "invalid recipient" errors, a new type of error recently popped: the mail service responds with > Net::SMTPServerBusy '400 unexpected recipients: want atleast 1, got 0' We want to also ignore this kind of errors.
This commit is contained in:
parent
640778641e
commit
e34f82a6fb
3 changed files with 22 additions and 2 deletions
|
@ -7,10 +7,18 @@ RSpec.describe ApplicationMailer, type: :mailer do
|
|||
before do
|
||||
allow_any_instance_of(DossierMailer)
|
||||
.to receive(:notify_new_draft)
|
||||
.and_raise(Net::SMTPSyntaxError)
|
||||
.and_raise(smtp_error)
|
||||
end
|
||||
|
||||
it { expect(subject.message).to be_an_instance_of(ActionMailer::Base::NullMail) }
|
||||
context 'when the server handles invalid emails with Net::SMTPSyntaxError' do
|
||||
let(:smtp_error) { Net::SMTPSyntaxError.new }
|
||||
it { expect(subject.message).to be_an_instance_of(ActionMailer::Base::NullMail) }
|
||||
end
|
||||
|
||||
context 'when the server handles invalid emails with Net::SMTPServerBusy' do
|
||||
let(:smtp_error) { Net::SMTPServerBusy.new('400 unexpected recipients: want atleast 1, got 0') }
|
||||
it { expect(subject.message).to be_an_instance_of(ActionMailer::Base::NullMail) }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'valid emails are sent' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue