Set validity, outzone, delete dates on domain creation #2622

This commit is contained in:
Martin Lensment 2015-06-10 11:08:33 +03:00
parent ffb1ab6521
commit 6546f51acf
3 changed files with 35 additions and 0 deletions

View file

@ -55,6 +55,13 @@ describe Domain do
@domain.errors.full_messages.should match_array([])
end
it 'should have correct validity dates' do
valid_to = Time.zone.now.beginning_of_day + 1.year
@domain.valid_to.should == valid_to
@domain.outzone_at.should == valid_to + Setting.expire_warning_period.days
@domain.delete_at.should == valid_to + Setting.expire_warning_period.days + Setting.redemption_grace_period.days
end
it 'should validate uniqueness of tech contacts' do
same_contact = Fabricate(:contact, code: 'same_contact')
domain = Fabricate(:domain)
@ -96,6 +103,17 @@ describe Domain do
@domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 1
end
it 'should start redemption grace period' do
Domain.start_redemption_grace_period
@domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 0
@domain.outzone_at = Time.zone.now
@domain.save
Domain.start_redemption_grace_period
@domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 1
end
context 'about registrant update confirm' do
before :all do
@domain.registrant_verification_token = 123