From 179845289bba48bcbdb1bd7e6850ecdd0e2bb5e8 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Thu, 8 Jan 2015 16:48:04 +0200 Subject: [PATCH] Fix tests --- app/models/nameserver.rb | 9 --------- spec/models/dnskey_spec.rb | 4 ++-- spec/models/domain_spec.rb | 1 - spec/support/epp.rb | 16 ++++++++++------ 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 86ca827af..65373034d 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -10,9 +10,6 @@ class Nameserver < ActiveRecord::Base validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true } # rubocop: enable Metrics/LineLength - # caching - after_commit :create_cache, on: [:create, :update] - # archiving has_paper_trail class_name: 'NameserverVersion' after_destroy :domain_version @@ -55,12 +52,6 @@ class Nameserver < ActiveRecord::Base domain.create_version if domain end - def create_cache - CachedNameserver.create(snapshot) - rescue ActiveRecord::RecordNotUnique - logger.info('Nameserver already exists in cache; not caching') - end - def to_s hostname end diff --git a/spec/models/dnskey_spec.rb b/spec/models/dnskey_spec.rb index 6e84ae02f..4b891a676 100644 --- a/spec/models/dnskey_spec.rb +++ b/spec/models/dnskey_spec.rb @@ -14,7 +14,7 @@ describe Dnskey do dk.generate_digest expect(dk.ds_digest).to eq('0B62D1BC64EFD1EE652FB102BDF1011BF514CCD9A1A0CFB7472AEA3B01F38C92') - expect(dk.ds_key_tag).to eq(30607) + expect(dk.ds_key_tag).to eq('30607') end it 'generates correct DS digest and DS key tag for emta.ee' do @@ -37,6 +37,6 @@ describe Dnskey do dk.save expect(dk.ds_digest).to eq('D7045D3C2EF7332409A132D935C8E2834A2AAB769B35BC370FA68C9445398288') - expect(dk.ds_key_tag).to eq(31051) + expect(dk.ds_key_tag).to eq('31051') end end diff --git a/spec/models/domain_spec.rb b/spec/models/domain_spec.rb index 2d2abded4..b61c2aa19 100644 --- a/spec/models/domain_spec.rb +++ b/spec/models/domain_spec.rb @@ -48,7 +48,6 @@ describe Domain do d = Domain.new expect(d.valid?).to be false expect(d.errors.messages).to match_array({ - period: ['is not a number'], owner_contact: ['Registrant is missing'], admin_contacts: ['Admin contacts count must be between 1 - infinity'], nameservers: ['Nameservers count must be between 2-11'], diff --git a/spec/support/epp.rb b/spec/support/epp.rb index 6203c2efa..52250d63c 100644 --- a/spec/support/epp.rb +++ b/spec/support/epp.rb @@ -193,9 +193,11 @@ module Epp } ], registrant: { value: 'jd1234' }, - contact: { value: 'sh8013', attrs: { type: 'admin' } }, - contact: { value: 'sh8013', attrs: { type: 'tech' } }, - contact: { value: 'sh801333', attrs: { type: 'tech' } }, + _anonymus: [ + { contact: { value: 'sh8013', attrs: { type: 'admin' } } }, + { contact: { value: 'sh8013', attrs: { type: 'tech' } } }, + { contact: { value: 'sh801333', attrs: { type: 'tech' } } } + ], authInfo: { pw: { value: '2fooBAR' @@ -235,9 +237,11 @@ module Epp } ], registrant: { value: 'jd1234' }, - contact: { value: 'sh8013', attrs: { type: 'admin' } }, - contact: { value: 'sh8013', attrs: { type: 'tech' } }, - contact: { value: 'sh801333', attrs: { type: 'tech' } }, + _anonymus: [ + { contact: { value: 'sh8013', attrs: { type: 'admin' } } }, + { contact: { value: 'sh8013', attrs: { type: 'tech' } } }, + { contact: { value: 'sh801333', attrs: { type: 'tech' } } } + ], authInfo: { pw: { value: '2fooBAR'