From 872d10b1f53c6a75ea71b9900037b04fbe7d444f Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 18 Apr 2016 17:22:59 +0300 Subject: [PATCH] Story#110308584 - update tests of contact --- app/jobs/update_whois_record_job.rb | 2 +- spec/models/contact_spec.rb | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/jobs/update_whois_record_job.rb b/app/jobs/update_whois_record_job.rb index 71f2b7e19..860fb09ae 100644 --- a/app/jobs/update_whois_record_job.rb +++ b/app/jobs/update_whois_record_job.rb @@ -1,7 +1,7 @@ class UpdateWhoisRecordJob < Que::Job def run(names, type) - klass = case type + klass = case type.to_s when 'reserved'then ReservedDomain when 'blocked' then BlockedDomain when 'domain' then Domain diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb index 23c180647..f573f0d5f 100644 --- a/spec/models/contact_spec.rb +++ b/spec/models/contact_spec.rb @@ -23,20 +23,21 @@ describe Contact do it 'should not be valid' do @contact.valid? - @contact.errors.full_messages.should match_array([ + @contact.errors.full_messages.should include( "Name Required parameter missing - name", "Phone Required parameter missing - phone", "Phone Phone nr is invalid", "Email Required parameter missing - email", "Email Email is invalid", "Ident Required parameter missing - ident", + "Ident Ident country code is not valid, should be in ISO_3166-1 alpha 2 format", "Registrar is missing", "Ident type is missing", "City is missing", "Country code is missing", "Street is missing", "Zip is missing" - ]) + ) end it 'should not have creator' do @@ -68,6 +69,7 @@ describe Contact do it 'should validate correct country code' do @contact.ident_type = 'org' @contact.ident_country_code = 'EE' + @contact.ident = '12345678' @contact.valid? @contact.errors[:ident_country_code].should == [] @@ -80,7 +82,7 @@ describe Contact do @contact.valid? @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 it 'should convert to alpha2 country code' do @@ -154,7 +156,7 @@ describe Contact do it 'org should be valid' do @contact.ident_type = 'org' - @contact.ident = '1234' + @contact.ident = '12345678' @contact.valid? @contact.errors.full_messages.should match_array([]) end