Registrant change now requires EPP verify attribute

This commit is contained in:
Priit Tark 2015-05-18 14:48:32 +03:00
parent 7d0365974e
commit d72cbc20f5
21 changed files with 318 additions and 29 deletions

View file

@ -33,6 +33,10 @@ describe Domain do
it 'should not have whois body' do
@domain.whois_record.should == nil
end
it 'should not be registrant update confirm ready' do
@domain.registrant_update_confirmable?('123').should == false
end
end
context 'with valid attributes' do
@ -77,6 +81,31 @@ describe Domain do
@domain.whois_record.json.present?.should == true
end
it 'should not be registrant update confirm ready' do
@domain.registrant_update_confirmable?('123').should == false
end
context 'about registrant update confirm' do
before :all do
@domain.registrant_verification_token = 123
@domain.registrant_verification_asked_at = Time.zone.now
@domain.domain_statuses.create(value: DomainStatus::PENDING_UPDATE)
end
it 'should be registrant update confirm ready' do
@domain.registrant_update_confirmable?('123').should == true
end
it 'should not be registrant update confirm ready when token does not match' do
@domain.registrant_update_confirmable?('wrong-token').should == false
end
it 'should not be registrant update confirm ready when no correct status' do
@domain.domain_statuses.delete_all
@domain.registrant_update_confirmable?('123').should == false
end
end
context 'with versioning' do
it 'should not have one version' do
with_versioning do

View file

@ -0,0 +1,34 @@
require 'rails_helper'
describe RegistrantVerification do
context 'with invalid attribute' do
before :all do
@registrant_verification = RegistrantVerification.new
end
it 'should not be valid' do
@registrant_verification.valid?
@registrant_verification.errors.full_messages.should match_array([
"Domain name is missing",
"Verification token is missing"
])
end
end
context 'with valid attributes' do
before :all do
@registrant_verification = Fabricate(:registrant_verification)
end
it 'should be valid' do
@registrant_verification.valid?
@registrant_verification.errors.full_messages.should match_array([])
end
it 'should be valid twice' do
@registrant_verification = Fabricate(:registrant_verification)
@registrant_verification.valid?
@registrant_verification.errors.full_messages.should match_array([])
end
end
end