mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 17:01:44 +02:00
parent
8e0226f4fb
commit
6a7a705fa8
4 changed files with 7 additions and 70 deletions
|
@ -1,42 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DomainDeleteForcedEmailJob do
|
||||
describe '#run' do
|
||||
let(:domain) { instance_double(Domain) }
|
||||
let(:message) { instance_double(ActionMailer::MessageDelivery) }
|
||||
|
||||
before :example do
|
||||
expect(Domain).to receive(:find).and_return(domain)
|
||||
allow(domain).to receive_messages(
|
||||
id: 1,
|
||||
name: 'test.com',
|
||||
registrar: 'registrar',
|
||||
registrant: 'registrant',
|
||||
primary_contact_emails: %w(test@test.com test@test.com))
|
||||
end
|
||||
|
||||
after :example do
|
||||
domain_id = 1
|
||||
template_name = 'removed_company'
|
||||
described_class.enqueue(domain_id, template_name)
|
||||
end
|
||||
|
||||
it 'creates log record' do
|
||||
log_message = 'Send DomainDeleteMailer#forced email for domain test.com (#1) to test@test.com, test@test.com'
|
||||
|
||||
allow(DomainDeleteMailer).to receive(:forced).and_return(message)
|
||||
allow(message).to receive(:deliver_now)
|
||||
|
||||
expect(Rails.logger).to receive(:info).with(log_message)
|
||||
end
|
||||
|
||||
it 'sends email' do
|
||||
expect(DomainDeleteMailer).to receive(:forced).with(domain: domain,
|
||||
registrar: 'registrar',
|
||||
registrant: 'registrant',
|
||||
template_name: 'removed_company')
|
||||
.and_return(message)
|
||||
expect(message).to receive(:deliver_now)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue