mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Rubocop fixes
This commit is contained in:
parent
897ead3391
commit
7b05cef8ea
3 changed files with 49 additions and 36 deletions
|
@ -69,9 +69,9 @@ class Domain < ActiveRecord::Base
|
|||
oc = owner_contact.snapshot if owner_contact.is_a?(Contact)
|
||||
{
|
||||
owner_contact: oc,
|
||||
tech_contacts: tech_contacts.map{ |tc| tc.snapshot },
|
||||
admin_contacts: admin_contacts.map{ |ac| ac.snapshot },
|
||||
nameservers: nameservers.map{ |ns| ns.snapshot },
|
||||
tech_contacts: tech_contacts.map(&:snapshot),
|
||||
admin_contacts: admin_contacts.map(&:snapshot),
|
||||
nameservers: nameservers.map(&:snapshot),
|
||||
domain: make_snapshot
|
||||
}.to_yaml
|
||||
end
|
||||
|
@ -313,5 +313,4 @@ class Domain < ActiveRecord::Base
|
|||
# return nil unless nameservers
|
||||
# return nameservers.map { |ns| ns.id }
|
||||
# end
|
||||
|
||||
end
|
||||
|
|
|
@ -102,7 +102,12 @@ describe Domain do
|
|||
end
|
||||
|
||||
context 'when saved' do
|
||||
before(:each) { Fabricate(:domain_validation_setting_group); Fabricate(:domain) }
|
||||
before(:each) do
|
||||
Fabricate(:domain_validation_setting_group)
|
||||
Fabricate(:dnskeys_setting_group)
|
||||
Fabricate(:domain)
|
||||
end
|
||||
|
||||
it 'creates domain version' do
|
||||
|
||||
expect(DomainVersion.count).to eq(1)
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'rails_helper'
|
|||
|
||||
describe DomainVersion do
|
||||
with_versioning do
|
||||
before(:each) { Fabricate(:domain_validation_setting_group) }
|
||||
before(:each) { Fabricate(:domain_validation_setting_group); Fabricate(:dnskeys_setting_group) }
|
||||
before(:each) do
|
||||
Fabricate(:domain, name: 'version.ee') do
|
||||
owner_contact { Fabricate(:contact, name: 'owner_contact', code: 'asd', email: 'owner1@v.ee') }
|
||||
|
@ -17,11 +17,14 @@ describe DomainVersion do
|
|||
it('has a snapshot') { expect(DomainVersion.first.snapshot).not_to be_empty }
|
||||
it 'has a snapshot with correct info' do
|
||||
expect(DomainVersion.last.load_snapshot).to eq({
|
||||
:admin_contacts => [{:name=>"admin_contact 1", :phone=>"+372.12345678", :code=>"qwe", :ident=>"37605030299", :email=>"admin1@v.ee"}],
|
||||
:domain => {:name=>"version.ee", :status=>nil},
|
||||
:nameservers => [{:hostname=>"ns.test.ee", :ipv4=>nil, :ipv6=>nil}],
|
||||
:owner_contact => {:name=>"owner_contact", :phone=>"+372.12345678", :code=>"asd", :ident=>"37605030299", :email=>"owner1@v.ee"},
|
||||
:tech_contacts => [{:name=>"tech_contact 1", :phone=>"+372.12345678", :code=>"zxc", :ident=>"37605030299", :email=>"tech1@v.ee"}]
|
||||
admin_contacts: [{ name: 'admin_contact 1', phone: '+372.12345678',
|
||||
code: 'qwe', ident: '37605030299', email: 'admin1@v.ee' }],
|
||||
domain: { name: 'version.ee', status: nil },
|
||||
nameservers: [{ hostname: 'ns.test.ee', ipv4: nil, ipv6: nil }],
|
||||
owner_contact: { name: 'owner_contact', phone: '+372.12345678',
|
||||
code: 'asd', ident: '37605030299', email: 'owner1@v.ee' },
|
||||
tech_contacts: [{ name: 'tech_contact 1', phone: '+372.12345678',
|
||||
code: 'zxc', ident: '37605030299', email: 'tech1@v.ee' }]
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -32,11 +35,12 @@ describe DomainVersion do
|
|||
Domain.first.destroy
|
||||
expect(DomainVersion.count).to eq(2)
|
||||
expect(DomainVersion.last.load_snapshot).to eq({
|
||||
:admin_contacts => [],
|
||||
:domain => {:name=>"version.ee", :status=>nil},
|
||||
:nameservers => [],
|
||||
:owner_contact => {:name=>"owner_contact", :phone=>"+372.12345678", :code=>"asd", :ident=>"37605030299", :email=>"owner1@v.ee"},
|
||||
:tech_contacts => []
|
||||
admin_contacts: [],
|
||||
domain: { name: 'version.ee', status: nil },
|
||||
nameservers: [],
|
||||
owner_contact: { name: 'owner_contact', phone: '+372.12345678',
|
||||
code: 'asd', ident: '37605030299', email: 'owner1@v.ee' },
|
||||
tech_contacts: []
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -47,11 +51,13 @@ describe DomainVersion do
|
|||
Contact.find_by(name: 'tech_contact 1').destroy
|
||||
expect(DomainVersion.count).to eq(2)
|
||||
expect(DomainVersion.last.load_snapshot).to eq({
|
||||
:admin_contacts => [{:name=>"admin_contact 1", :phone=>"+372.12345678", :code=>"qwe", :ident=>"37605030299", :email=>"admin1@v.ee"}],
|
||||
:domain => {:name=>"version.ee", :status=>nil},
|
||||
:nameservers => [{:hostname=>"ns.test.ee", :ipv4=>nil, :ipv6=>nil}],
|
||||
:owner_contact => {:name=>"owner_contact", :phone=>"+372.12345678", :code=>"asd", :ident=>"37605030299", :email=>"owner1@v.ee"},
|
||||
:tech_contacts => []
|
||||
admin_contacts: [{ name: 'admin_contact 1', phone: '+372.12345678',
|
||||
code: 'qwe', ident: '37605030299', email: 'admin1@v.ee' }],
|
||||
domain: { name: 'version.ee', status: nil },
|
||||
nameservers: [{ hostname: 'ns.test.ee', ipv4: nil, ipv6: nil }],
|
||||
owner_contact: { name: 'owner_contact', phone: '+372.12345678',
|
||||
code: 'asd', ident: '37605030299', email: 'owner1@v.ee' },
|
||||
tech_contacts: []
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -72,11 +78,14 @@ describe DomainVersion do
|
|||
Contact.find_by(name: 'admin_contact 1').update_attributes!(name: 'edited admin_contact')
|
||||
expect(DomainVersion.count).to eq(4)
|
||||
expect(DomainVersion.last.load_snapshot).to eq({
|
||||
:admin_contacts => [{:name=>"edited admin_contact", :phone=>"+372.12345678", :code=>"qwe", :ident=>"37605030299", :email=>"admin1@v.ee"}],
|
||||
:domain => {:name=>"version.ee", :status=>nil},
|
||||
:nameservers => [{:hostname=>"ns.test.ee", :ipv4=>nil, :ipv6=>nil}],
|
||||
:owner_contact => {:name=>"edited owner_contact", :phone=>"+372.12345678", :code=>"asd", :ident=>"37605030299", :email=>"owner1@v.ee"},
|
||||
:tech_contacts => [{:name=>"edited tech_contact", :phone=>"+372.12345678", :code=>"zxc", :ident=>"37605030299", :email=>"tech1@v.ee"}]
|
||||
admin_contacts: [{ name: 'edited admin_contact', phone: '+372.12345678',
|
||||
code: 'qwe', ident: '37605030299', email: 'admin1@v.ee' }],
|
||||
domain: { name: 'version.ee', status: nil },
|
||||
nameservers: [{ hostname: 'ns.test.ee', ipv4: nil, ipv6: nil }],
|
||||
owner_contact: { name: 'edited owner_contact', phone: '+372.12345678',
|
||||
code: 'asd', ident: '37605030299', email: 'owner1@v.ee' },
|
||||
tech_contacts: [{ name: 'edited tech_contact', phone: '+372.12345678',
|
||||
code: 'zxc', ident: '37605030299', email: 'tech1@v.ee' }]
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue