mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
parent
9dca942b78
commit
14c5c3efed
3 changed files with 41 additions and 37 deletions
|
@ -210,11 +210,6 @@ class Domain < ActiveRecord::Base
|
||||||
DomainCron.send(__method__)
|
DomainCron.send(__method__)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.start_expire_period
|
|
||||||
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
|
|
||||||
DomainCron.send(__method__)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.start_redemption_grace_period
|
def self.start_redemption_grace_period
|
||||||
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
|
ActiveSupport::Deprecation.instance.deprecation_warning(DomainCron, __method__)
|
||||||
DomainCron.send(__method__)
|
DomainCron.send(__method__)
|
||||||
|
|
41
spec/models/domain_cron_spec.rb
Normal file
41
spec/models/domain_cron_spec.rb
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe DomainCron do
|
||||||
|
before :example do
|
||||||
|
Fabricate(:zonefile_setting, origin: 'ee')
|
||||||
|
|
||||||
|
@domain = Fabricate(:domain)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should expire domains' do
|
||||||
|
Setting.expire_warning_period = 1
|
||||||
|
Setting.redemption_grace_period = 1
|
||||||
|
|
||||||
|
described_class.start_expire_period
|
||||||
|
@domain.statuses.include?(DomainStatus::EXPIRED).should == false
|
||||||
|
|
||||||
|
old_valid_to = Time.zone.now - 10.days
|
||||||
|
@domain.valid_to = old_valid_to
|
||||||
|
@domain.save
|
||||||
|
|
||||||
|
described_class.start_expire_period
|
||||||
|
@domain.reload
|
||||||
|
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
||||||
|
|
||||||
|
described_class.start_expire_period
|
||||||
|
@domain.reload
|
||||||
|
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should start redemption grace period' do
|
||||||
|
old_valid_to = Time.zone.now - 10.days
|
||||||
|
@domain.valid_to = old_valid_to
|
||||||
|
@domain.statuses = [DomainStatus::EXPIRED]
|
||||||
|
@domain.outzone_at, @domain.delete_at = nil, nil
|
||||||
|
@domain.save
|
||||||
|
|
||||||
|
described_class.start_expire_period
|
||||||
|
@domain.reload
|
||||||
|
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
||||||
|
end
|
||||||
|
end
|
|
@ -148,38 +148,6 @@ RSpec.describe Domain do
|
||||||
domain.pending_json.should == {}
|
domain.pending_json.should == {}
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should expire domains' do
|
|
||||||
Setting.expire_warning_period = 1
|
|
||||||
Setting.redemption_grace_period = 1
|
|
||||||
|
|
||||||
DomainCron.start_expire_period
|
|
||||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == false
|
|
||||||
|
|
||||||
old_valid_to = Time.zone.now - 10.days
|
|
||||||
@domain.valid_to = old_valid_to
|
|
||||||
@domain.save
|
|
||||||
|
|
||||||
DomainCron.start_expire_period
|
|
||||||
@domain.reload
|
|
||||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
|
||||||
|
|
||||||
DomainCron.start_expire_period
|
|
||||||
@domain.reload
|
|
||||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should start redemption grace period' do
|
|
||||||
old_valid_to = Time.zone.now - 10.days
|
|
||||||
@domain.valid_to = old_valid_to
|
|
||||||
@domain.statuses = [DomainStatus::EXPIRED]
|
|
||||||
@domain.outzone_at, @domain.delete_at = nil, nil
|
|
||||||
@domain.save
|
|
||||||
|
|
||||||
DomainCron.start_expire_period
|
|
||||||
@domain.reload
|
|
||||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should start redemption grace period' do
|
it 'should start redemption grace period' do
|
||||||
DomainCron.start_redemption_grace_period
|
DomainCron.start_redemption_grace_period
|
||||||
@domain.reload
|
@domain.reload
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue