Story#110308584 - update tests of contact

This commit is contained in:
Vladimir Krylov 2016-04-18 17:22:59 +03:00
parent 31604d62d7
commit 872d10b1f5
2 changed files with 7 additions and 5 deletions

View file

@ -1,7 +1,7 @@
class UpdateWhoisRecordJob < Que::Job class UpdateWhoisRecordJob < Que::Job
def run(names, type) def run(names, type)
klass = case type klass = case type.to_s
when 'reserved'then ReservedDomain when 'reserved'then ReservedDomain
when 'blocked' then BlockedDomain when 'blocked' then BlockedDomain
when 'domain' then Domain when 'domain' then Domain

View file

@ -23,20 +23,21 @@ describe Contact do
it 'should not be valid' do it 'should not be valid' do
@contact.valid? @contact.valid?
@contact.errors.full_messages.should match_array([ @contact.errors.full_messages.should include(
"Name Required parameter missing - name", "Name Required parameter missing - name",
"Phone Required parameter missing - phone", "Phone Required parameter missing - phone",
"Phone Phone nr is invalid", "Phone Phone nr is invalid",
"Email Required parameter missing - email", "Email Required parameter missing - email",
"Email Email is invalid", "Email Email is invalid",
"Ident Required parameter missing - ident", "Ident Required parameter missing - ident",
"Ident Ident country code is not valid, should be in ISO_3166-1 alpha 2 format",
"Registrar is missing", "Registrar is missing",
"Ident type is missing", "Ident type is missing",
"City is missing", "City is missing",
"Country code is missing", "Country code is missing",
"Street is missing", "Street is missing",
"Zip is missing" "Zip is missing"
]) )
end end
it 'should not have creator' do it 'should not have creator' do
@ -68,6 +69,7 @@ describe Contact do
it 'should validate correct country code' do it 'should validate correct country code' do
@contact.ident_type = 'org' @contact.ident_type = 'org'
@contact.ident_country_code = 'EE' @contact.ident_country_code = 'EE'
@contact.ident = '12345678'
@contact.valid? @contact.valid?
@contact.errors[:ident_country_code].should == [] @contact.errors[:ident_country_code].should == []
@ -80,7 +82,7 @@ describe Contact do
@contact.valid? @contact.valid?
@contact.errors[:ident].should == @contact.errors[:ident].should ==
['Ident country code is not valid, should be in ISO_3166-1 alpha 2 format'] ['Ident country code is not valid, should be in ISO_3166-1 alpha 2 format', 'Ident country code is not valid, should be in ISO_3166-1 alpha 2 format']
end end
it 'should convert to alpha2 country code' do it 'should convert to alpha2 country code' do
@ -154,7 +156,7 @@ describe Contact do
it 'org should be valid' do it 'org should be valid' do
@contact.ident_type = 'org' @contact.ident_type = 'org'
@contact.ident = '1234' @contact.ident = '12345678'
@contact.valid? @contact.valid?
@contact.errors.full_messages.should match_array([]) @contact.errors.full_messages.should match_array([])
end end