mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 08:22:05 +02:00
parent
0cc3a53deb
commit
f127716a39
5 changed files with 36 additions and 22 deletions
|
@ -1,11 +1,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DomainExpirationEmailJob do
|
||||
it 'queues the job' do
|
||||
expect { described_class.perform_later }.to have_enqueued_job(described_class)
|
||||
end
|
||||
|
||||
describe '#perform' do
|
||||
describe '#run' do
|
||||
let(:domain) { instance_double(Domain) }
|
||||
|
||||
before :example do
|
||||
|
@ -22,7 +18,7 @@ RSpec.describe DomainExpirationEmailJob do
|
|||
it 'sends email notification' do
|
||||
expect(DomainMailer).to receive(:expiration).with(domain: domain).and_return(message)
|
||||
expect(message).to receive(:deliver!)
|
||||
described_class.perform_now(domain_id: 1)
|
||||
described_class.enqueue(domain_id: 1)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -33,7 +29,7 @@ RSpec.describe DomainExpirationEmailJob do
|
|||
|
||||
it 'does not send email notification' do
|
||||
expect(DomainMailer).to_not receive(:expiration)
|
||||
described_class.perform_now(domain_id: 1)
|
||||
described_class.enqueue(domain_id: 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe DomainCron do
|
||||
before :example do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
|
||||
@domain = Fabricate(:domain)
|
||||
end
|
||||
|
||||
it 'should expire domains' do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
@domain = Fabricate(:domain)
|
||||
|
||||
Setting.expire_warning_period = 1
|
||||
Setting.redemption_grace_period = 1
|
||||
|
||||
|
@ -28,6 +25,9 @@ RSpec.describe DomainCron do
|
|||
end
|
||||
|
||||
it 'should start redemption grace period' do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
@domain = Fabricate(:domain)
|
||||
|
||||
old_valid_to = Time.zone.now - 10.days
|
||||
@domain.valid_to = old_valid_to
|
||||
@domain.statuses = [DomainStatus::EXPIRED]
|
||||
|
@ -38,4 +38,15 @@ RSpec.describe DomainCron do
|
|||
@domain.reload
|
||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
||||
end
|
||||
|
||||
describe '::start_expire_period', db: false do
|
||||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010')
|
||||
end
|
||||
|
||||
it 'logs start time' do
|
||||
expect(Rails.logger).to receive(:info).with('Expiring domains')
|
||||
described_class.start_expire_period
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe RegistrarPresenter do
|
||||
let(:registrar) { instance_double(Registrar) }
|
||||
let(:presenter) { described_class.new(registrar: registrar, view: nil) }
|
||||
let(:presenter) { described_class.new(registrar: registrar, view: view) }
|
||||
|
||||
describe '#name' do
|
||||
it 'returns name' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue