Fix tests

This commit is contained in:
Martin Lensment 2015-01-08 16:48:04 +02:00
parent 1054a3d2ba
commit 179845289b
4 changed files with 12 additions and 18 deletions

View file

@ -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

View file

@ -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

View file

@ -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'],

View file

@ -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'