mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
Improve domain expiring logic #2909
This commit is contained in:
parent
58249742c1
commit
7064a4b9bc
4 changed files with 46 additions and 24 deletions
|
@ -82,10 +82,8 @@ describe Domain do
|
|||
it 'should have correct validity dates' do
|
||||
valid_to = Time.zone.now + 1.year
|
||||
@domain.valid_to.should be_within(5).of(valid_to)
|
||||
@domain.outzone_at.should be_within(5).of(valid_to + Setting.expire_warning_period.days)
|
||||
@domain.delete_at.should be_within(5).of(
|
||||
valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
|
||||
)
|
||||
@domain.outzone_at.should be_nil
|
||||
@domain.delete_at.should be_nil
|
||||
end
|
||||
|
||||
it 'should validate uniqueness of tech contacts' do
|
||||
|
@ -146,18 +144,39 @@ describe Domain do
|
|||
Domain.start_expire_period
|
||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == false
|
||||
|
||||
@domain.valid_to = Time.zone.now - 10.days
|
||||
old_valid_to = Time.zone.now - 10.days
|
||||
@domain.valid_to = old_valid_to
|
||||
@domain.save
|
||||
|
||||
Domain.start_expire_period
|
||||
@domain.reload
|
||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
||||
@domain.outzone_at.should be_within(5).of(old_valid_to + Setting.expire_warning_period.days)
|
||||
@domain.delete_at.should be_within(5).of(
|
||||
old_valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
|
||||
)
|
||||
|
||||
Domain.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
|
||||
|
||||
Domain.start_expire_period
|
||||
@domain.reload
|
||||
@domain.statuses.include?(DomainStatus::EXPIRED).should == true
|
||||
@domain.outzone_at.should be_within(5).of(old_valid_to + Setting.expire_warning_period.days)
|
||||
@domain.delete_at.should be_within(5).of(
|
||||
old_valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
|
||||
)
|
||||
end
|
||||
|
||||
it 'should start redemption grace period' do
|
||||
Domain.start_redemption_grace_period
|
||||
@domain.reload
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue