mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 08:22:05 +02:00
Handle invalid emails in DomainExpireMailer#expired, move logging from job to mailer
#186
This commit is contained in:
parent
a5c0333a5d
commit
e6e3ab9e1e
4 changed files with 78 additions and 43 deletions
|
@ -18,21 +18,11 @@ RSpec.describe DomainExpireEmailJob do
|
|||
|
||||
before :example do
|
||||
allow(domain).to receive_messages(
|
||||
id: 1,
|
||||
registrar: 'registrar',
|
||||
registered?: false,
|
||||
primary_contact_emails: %w(test@test.com test@test.com))
|
||||
end
|
||||
|
||||
it 'creates log record' do
|
||||
log_message = 'Send DomainExpireMailer#expired email for domain #1 to test@test.com, test@test.com'
|
||||
|
||||
allow(DomainExpireMailer).to receive(:expired).and_return(message)
|
||||
allow(message).to receive(:deliver_now)
|
||||
|
||||
expect(Rails.logger).to receive(:info).with(log_message)
|
||||
end
|
||||
|
||||
it 'sends email' do
|
||||
expect(DomainExpireMailer).to receive(:expired).with(domain: domain, registrar: 'registrar')
|
||||
.and_return(message)
|
||||
|
@ -45,10 +35,6 @@ RSpec.describe DomainExpireEmailJob do
|
|||
allow(domain).to receive(:registered?).and_return(true)
|
||||
end
|
||||
|
||||
it 'does not create log record' do
|
||||
expect(Rails.logger).to_not receive(:info)
|
||||
end
|
||||
|
||||
it 'does not send email' do
|
||||
expect(DomainExpireMailer).to_not receive(:expired)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue