Expire old pendings #2557

This commit is contained in:
Priit Tark 2015-07-14 19:56:41 +03:00
parent 8102b8f1a2
commit 1769ea4227
10 changed files with 77 additions and 14 deletions

View file

@ -94,6 +94,30 @@ describe Domain do
@domain.registrant_update_confirmable?('123').should == false
end
it 'should not find any domain pendings to clean' do
Domain.clean_expired_pendings.should == 0
end
it 'should not find any domains with wrong pendings' do
domain = Fabricate(:domain)
domain.registrant_verification_asked!('frame-str', '1')
domain.registrant_verification_asked_at = 30.days.ago
domain.save
Domain.clean_expired_pendings.should == 0
end
it 'should clean domain pendings' do
domain = Fabricate(:domain)
domain.registrant_verification_asked!('frame-str', '1')
domain.registrant_verification_asked_at = 30.days.ago
domain.pending_delete!
Domain.clean_expired_pendings.should == 1
domain.reload.pending_delete?.should == false
domain.pending_json.should == {}
end
it 'should expire domains' do
Domain.start_expire_period
@domain.statuses.include?(DomainStatus::EXPIRED).should == false