mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 02:09:39 +02:00
Merge branch 'master' of github.com:internetee/registry
This commit is contained in:
commit
ebb389248e
16 changed files with 340 additions and 56 deletions
|
@ -1,5 +1,6 @@
|
|||
class Client::DomainVersionsController < ClientController
|
||||
before_action :set_version, only: [:show]
|
||||
helper WhodunnitHelper
|
||||
before_action :set_domain, only: [:show]
|
||||
|
||||
def index
|
||||
@versions = DomainVersion.registrar_events(current_registrar.id)
|
||||
|
@ -7,13 +8,12 @@ class Client::DomainVersionsController < ClientController
|
|||
end
|
||||
|
||||
def show
|
||||
@event = params[:event]
|
||||
@domain = @version.reify(has_multiple: true) unless @event == 'create'
|
||||
@versions = @domain.versions.reverse
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_version
|
||||
@version = DomainVersion.find(params[:id])
|
||||
def set_domain
|
||||
@domain = Domain.find(params[:id])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,8 +5,6 @@ class Contact < ActiveRecord::Base
|
|||
|
||||
include EppErrors
|
||||
|
||||
# has_one :local_address, dependent: :destroy
|
||||
# has_one :international_address, dependent: :destroy
|
||||
has_one :address, dependent: :destroy
|
||||
has_one :disclosure, class_name: 'ContactDisclosure'
|
||||
|
||||
|
@ -35,6 +33,11 @@ class Contact < ActiveRecord::Base
|
|||
delegate :street, to: :address # , prefix: true
|
||||
delegate :zip, to: :address # , prefix: true
|
||||
|
||||
# callbacks
|
||||
# after_commit :domains_snapshot
|
||||
after_update :domains_snapshot
|
||||
after_destroy :domains_snapshot
|
||||
|
||||
# scopes
|
||||
scope :current_registrars, ->(id) { where(registrar_id: id) }
|
||||
# archiving
|
||||
|
@ -60,6 +63,14 @@ class Contact < ActiveRecord::Base
|
|||
errors.add(:ident, 'bad format') unless code.valid?
|
||||
end
|
||||
|
||||
def domains_snapshot
|
||||
(domains + domains_owned).uniq.each do |domain|
|
||||
next unless domain.is_a?(Domain)
|
||||
# next if domain.versions.last == domain.create_snapshot
|
||||
domain.create_version # Method from paper_trail
|
||||
end
|
||||
end
|
||||
|
||||
def juridical?
|
||||
ident_type == IDENT_TYPE_ICO
|
||||
end
|
||||
|
@ -123,6 +134,17 @@ class Contact < ActiveRecord::Base
|
|||
name
|
||||
end
|
||||
|
||||
# for archiving
|
||||
def snapshot
|
||||
{
|
||||
name: name,
|
||||
phone: phone,
|
||||
code: code,
|
||||
ident: ident,
|
||||
email: email
|
||||
}
|
||||
end
|
||||
|
||||
class << self
|
||||
# non-EPP
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ class Domain < ActiveRecord::Base
|
|||
-> { where(domain_contacts: { contact_type: DomainContact::ADMIN }) },
|
||||
through: :domain_contacts, source: :contact
|
||||
|
||||
has_many :nameservers, dependent: :delete_all
|
||||
has_many :nameservers, dependent: :delete_all, after_add: :track_nameserver_add
|
||||
|
||||
accepts_nested_attributes_for :nameservers, allow_destroy: true,
|
||||
reject_if: proc { |attrs| attrs[:hostname].blank? }
|
||||
|
||||
|
@ -57,10 +58,47 @@ class Domain < ActiveRecord::Base
|
|||
validate :validate_dnskeys_uniqueness
|
||||
validate :validate_nameserver_ips
|
||||
|
||||
attr_accessor :owner_contact_typeahead
|
||||
attr_accessor :owner_contact_typeahead, :update_me
|
||||
|
||||
# archiving
|
||||
has_paper_trail class_name: 'DomainVersion'
|
||||
# if proc works only on changes on domain sadly
|
||||
has_paper_trail class_name: 'DomainVersion', meta: { snapshot: :create_snapshot }, if: proc(&:new_version)
|
||||
|
||||
def new_version
|
||||
return false if versions.try(:last).try(:snapshot) == create_snapshot
|
||||
true
|
||||
end
|
||||
|
||||
def create_version
|
||||
return true unless PaperTrail.enabled?
|
||||
return true unless valid?
|
||||
touch_with_version if new_version
|
||||
end
|
||||
|
||||
def track_nameserver_add(_nameserver)
|
||||
return true if versions.count == 0
|
||||
return true unless valid? && new_version
|
||||
|
||||
touch_with_version
|
||||
end
|
||||
|
||||
def create_snapshot
|
||||
oc = owner_contact.snapshot if owner_contact.is_a?(Contact)
|
||||
{
|
||||
owner_contact: oc,
|
||||
tech_contacts: tech_contacts.map(&:snapshot),
|
||||
admin_contacts: admin_contacts.map(&:snapshot),
|
||||
nameservers: nameservers.map(&:snapshot),
|
||||
domain: make_snapshot
|
||||
}.to_yaml
|
||||
end
|
||||
|
||||
def make_snapshot
|
||||
{
|
||||
name: name,
|
||||
status: status
|
||||
}
|
||||
end
|
||||
|
||||
def name=(value)
|
||||
value.strip!
|
||||
|
|
|
@ -3,6 +3,10 @@ class DomainContact < ActiveRecord::Base
|
|||
belongs_to :contact
|
||||
belongs_to :domain
|
||||
|
||||
after_create :domain_snapshot
|
||||
after_destroy :domain_snapshot
|
||||
# after_save :domain_snapshot
|
||||
|
||||
attr_accessor :value_typeahead
|
||||
|
||||
def epp_code_map
|
||||
|
@ -33,4 +37,11 @@ class DomainContact < ActiveRecord::Base
|
|||
def value_typeahead
|
||||
@value_typeahead || contact.try(:name) || nil
|
||||
end
|
||||
|
||||
def domain_snapshot
|
||||
return true if domain.nil?
|
||||
return true if domain.versions.count == 0 # avoid snapshot on creation
|
||||
domain.create_version
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,4 +5,8 @@ class DomainVersion < PaperTrail::Version
|
|||
|
||||
self.table_name = :domain_versions
|
||||
self.sequence_name = :domain_version_id_seq
|
||||
|
||||
def load_snapshot
|
||||
YAML.load(snapshot)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,7 @@ class Nameserver < ActiveRecord::Base
|
|||
|
||||
# archiving
|
||||
has_paper_trail class_name: 'NameserverVersion'
|
||||
after_destroy :domain_version
|
||||
|
||||
before_validation :normalize_attributes
|
||||
|
||||
|
@ -31,12 +32,24 @@ class Nameserver < ActiveRecord::Base
|
|||
}
|
||||
end
|
||||
|
||||
def snapshot
|
||||
{
|
||||
hostname: hostname,
|
||||
ipv4: ipv4,
|
||||
ipv6: ipv6
|
||||
}
|
||||
end
|
||||
|
||||
def normalize_attributes
|
||||
self.hostname = hostname.try(:strip).try(:downcase)
|
||||
self.ipv4 = ipv4.try(:strip)
|
||||
self.ipv6 = ipv6.try(:strip).try(:upcase)
|
||||
end
|
||||
|
||||
def domain_version
|
||||
domain.create_version if domain
|
||||
end
|
||||
|
||||
def to_s
|
||||
hostname
|
||||
end
|
||||
|
|
|
@ -2,23 +2,63 @@
|
|||
.col-sm-6
|
||||
%h2.text-center-xs= t('shared.domains')
|
||||
%hr
|
||||
.row
|
||||
- if @event != 'create'
|
||||
.col-sm-6= render 'client/domains/partials/general'
|
||||
- if @event != 'create' && @domain.owner_contact
|
||||
.col-sm-6= render 'client/domains/partials/owner'
|
||||
- if @event != 'create' && @domain.tech_contacts
|
||||
.col-sm-6= render 'client/domains/partials/tech_contacts'
|
||||
.col-sm-6
|
||||
.panel.panel-default
|
||||
.panel-heading
|
||||
%h3.panel-title= t('shared.version')
|
||||
.panel-body
|
||||
%dl.dl-horizontal
|
||||
%dt= t('shared.whodunnit')
|
||||
%dd= @version.whodunnit
|
||||
%dt= t('shared.event')
|
||||
%dd= @version.event
|
||||
%dt= t('shared.created_at')
|
||||
%dd= l(@version.created_at, format: :short)
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
.table-responsive
|
||||
%table.table-hover.table-bordered.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th{class: 'col-xs-1'}= 'domain'
|
||||
%th{class: 'col-xs-2'}= 'owner'
|
||||
%th{class: 'col-xs-2'}= 'admins'
|
||||
%th{class: 'col-xs-2'}= 'techs'
|
||||
%th{class: 'col-xs-2'}= 'ns'
|
||||
%th{class: 'col-xs-1'}= 'datetime'
|
||||
%tbody
|
||||
- @versions.each do |version|
|
||||
- children = YAML.load(version.snapshot)
|
||||
- next unless children.is_a?(Hash)
|
||||
- children = HashWithIndifferentAccess.new(children)
|
||||
%tr
|
||||
%td
|
||||
- if children[:domain]
|
||||
= children[:domain][:name]
|
||||
= children[:domain][:status]
|
||||
%td
|
||||
- if children[:owner_contact]
|
||||
%p{:style => "font-size:x-small;"}
|
||||
= children[:owner_contact][:name] + ","
|
||||
= children[:owner_contact][:phone] + ","
|
||||
= children[:owner_contact][:email] + ","
|
||||
= children[:owner_contact][:code]
|
||||
%td
|
||||
- if children[:admin_contacts]
|
||||
- children[:admin_contacts].each do |ac|
|
||||
%p{:style => "font-size:x-small;"}
|
||||
= ac[:name] + ","
|
||||
= ac[:phone] + ","
|
||||
= ac[:email] + ","
|
||||
= ac[:code]
|
||||
%td
|
||||
- if children[:tech_contacts]
|
||||
- children[:tech_contacts].each do |tc|
|
||||
%p{:style => "font-size:x-small;"}
|
||||
= tc[:name] + ","
|
||||
= tc[:phone] + ","
|
||||
= tc[:email] + ","
|
||||
= tc[:code]
|
||||
%td
|
||||
- if children[:nameservers]
|
||||
- children[:nameservers].each do |ns|
|
||||
%p{:style => "font-size:x-small;"}
|
||||
= ns[:hostname] + ","
|
||||
= ns[:ipv4] || ns[:ipv6]
|
||||
|
||||
%td
|
||||
%p{ :style => 'font-size:x-small;' }
|
||||
= l(version.created_at, format: :short)
|
||||
= whodunnit_with_protocol(version.whodunnit)
|
||||
=# version.whodunnit
|
||||
=# version.event
|
||||
|
||||
|
|
|
@ -30,12 +30,14 @@
|
|||
= sort_link(@q, 'owner_contact_name', t('shared.owner'))
|
||||
%th{class: 'col-xs-2'}
|
||||
= sort_link(@q, 'valid_to', t('shared.valid_to'))
|
||||
%th{class: 'col-xs-1'}
|
||||
%tbody
|
||||
- @domains.each do |x|
|
||||
%tr
|
||||
%td= link_to(x, client_domain_path(x))
|
||||
%td= link_to(x.owner_contact, [:client, x.owner_contact])
|
||||
%td= l(x.valid_to, format: :short)
|
||||
%td= link_to t('shared.history'), client_domain_version_path(x.id), class: 'btn btn-primary'
|
||||
.row
|
||||
.col-md-12
|
||||
= paginate @domains
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
%li
|
||||
= link_to t('shared.contact_list'), client_contacts_path
|
||||
|
||||
%li.dropdown
|
||||
-# %li.dropdown
|
||||
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
|
||||
= t('shared.history')
|
||||
%span.caret
|
||||
|
|
|
@ -362,6 +362,7 @@ en:
|
|||
contact_list: 'Contact list'
|
||||
create_new_contact: 'Create new contact'
|
||||
domain_pw: 'Domain password'
|
||||
history: 'History'
|
||||
|
||||
new_registrar: 'New registrar'
|
||||
registrar_added: 'Registrar added!'
|
||||
|
@ -405,7 +406,6 @@ en:
|
|||
record_deleted: 'Record deleted'
|
||||
failed_to_delete_record: 'Failed to delete record'
|
||||
|
||||
# sorry these need to be refactored - Andres
|
||||
authentication_error: 'Authentication error'
|
||||
ds_data_and_key_data_must_not_exists_together: 'dsData and keyData objects must not exists together'
|
||||
|
||||
|
@ -420,3 +420,4 @@ en:
|
|||
setting: 'Setting'
|
||||
|
||||
registrar: Registrar
|
||||
|
||||
|
|
5
db/migrate/20141010085152_add_snapshot_to_domain.rb
Normal file
5
db/migrate/20141010085152_add_snapshot_to_domain.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddSnapshotToDomain < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :domain_versions, :snapshot, :text
|
||||
end
|
||||
end
|
|
@ -156,6 +156,7 @@ ActiveRecord::Schema.define(version: 20141015135742) do
|
|||
t.string "whodunnit"
|
||||
t.text "object"
|
||||
t.datetime "created_at"
|
||||
t.text "snapshot"
|
||||
end
|
||||
|
||||
add_index "domain_versions", ["item_type", "item_id"], name: "index_domain_versions_on_item_type_and_item_id", using: :btree
|
||||
|
|
|
@ -80,18 +80,6 @@ describe 'EPP Contact', epp: true do
|
|||
expect(id.text.length).to eq(8)
|
||||
# 5 seconds for what-ever weird lag reasons might happen
|
||||
expect(cr_date.text.to_time).to be_within(5).of(Time.now)
|
||||
|
||||
end
|
||||
|
||||
it 'does not create duplicate contact', pending: true do
|
||||
Fabricate(:contact, code: 'sh8013')
|
||||
|
||||
response = epp_request(contact_create_xml, :xml)
|
||||
|
||||
expect(response[:result_code]).to eq('2302')
|
||||
expect(response[:msg]).to eq('Contact id already exists')
|
||||
|
||||
expect(Contact.count).to eq(1)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -115,16 +103,6 @@ describe 'EPP Contact', epp: true do
|
|||
expect(response[:result_code]).to eq('2201')
|
||||
end
|
||||
|
||||
it 'stamps updated_by succesfully', pending: true do
|
||||
Fabricate(:contact, code: 'sh8013', created_by_id: zone.id)
|
||||
|
||||
expect(Contact.first.updated_by_id).to be nil
|
||||
|
||||
epp_request(contact_update_xml, :xml)
|
||||
|
||||
expect(Contact.first.updated_by_id).to eq 2
|
||||
end
|
||||
|
||||
it 'is succesful' do
|
||||
Fabricate(
|
||||
:contact,
|
||||
|
|
|
@ -7,13 +7,12 @@ end
|
|||
|
||||
describe Address, '.extract_params' do
|
||||
|
||||
# TODO: please fix
|
||||
it 'returns params hash', pending: true do
|
||||
it 'returns params hash' do
|
||||
Fabricate(:country, iso: 'EE')
|
||||
ph = { postalInfo: { name: 'fred', addr: { cc: 'EE', city: 'Village', street: %w(street1 street2) } } }
|
||||
expect(Address.extract_attributes(ph[:postalInfo])).to eq({
|
||||
address_attributes: {
|
||||
country_id: 1,
|
||||
country_id: Country.find_by(iso: 'EE').id,
|
||||
city: 'Village',
|
||||
street: 'street1',
|
||||
street2: 'street2'
|
||||
|
|
|
@ -96,4 +96,33 @@ describe Domain do
|
|||
expect(d.auth_info).to_not be_empty
|
||||
end
|
||||
end
|
||||
|
||||
with_versioning do
|
||||
context 'when not saved' do
|
||||
it 'does not create domain version' do
|
||||
Fabricate.build(:domain)
|
||||
expect(DomainVersion.count).to eq(0)
|
||||
end
|
||||
|
||||
it 'does not create child versions' do
|
||||
Fabricate.build(:domain)
|
||||
expect(ContactVersion.count).to eq(0)
|
||||
expect(NameserverVersion.count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when saved' do
|
||||
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)
|
||||
expect(ContactVersion.count).to eq(2)
|
||||
expect(NameserverVersion.count).to eq(3)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
141
spec/models/domain_version_spec.rb
Normal file
141
spec/models/domain_version_spec.rb
Normal file
|
@ -0,0 +1,141 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe DomainVersion do
|
||||
with_versioning do
|
||||
before(:each) do
|
||||
Setting.ns_min_count = 1
|
||||
Fabricate(:domain, name: 'version.ee', dnskeys: []) do
|
||||
owner_contact { Fabricate(:contact, name: 'owner_contact', code: 'asd', email: 'owner1@v.ee') }
|
||||
nameservers(count: 1) { Fabricate(:nameserver, hostname: 'ns.test.ee') }
|
||||
admin_contacts(count: 1) { Fabricate(:contact, name: 'admin_contact 1', code: 'qwe', email: 'admin1@v.ee') }
|
||||
tech_contacts(count: 1) { Fabricate(:contact, name: 'tech_contact 1', code: 'zxc', email: 'tech1@v.ee') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'when domain is created' do
|
||||
it('creates a domain version') { expect(DomainVersion.count).to eq(1) }
|
||||
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' }]
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'when domain is deleted' do
|
||||
it 'creates a version' do
|
||||
expect(DomainVersion.count).to eq(1)
|
||||
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: []
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'when adding child' do
|
||||
it 'contact creates a version' do
|
||||
expect(DomainVersion.count).to eq(1)
|
||||
expect(Domain.last.tech_contacts.count).to eq(1)
|
||||
Domain.last.tech_contacts << Fabricate(:contact, name: 'tech contact 2', phone: '+371.12345678',
|
||||
code: '123', email: 'tech2@v.ee')
|
||||
expect(Domain.last.tech_contacts.count).to eq(2)
|
||||
expect(DomainVersion.count).to eq(2)
|
||||
end
|
||||
|
||||
it 'nameserver creates a version' do
|
||||
expect(DomainVersion.count).to eq(1)
|
||||
expect(Domain.last.nameservers.count).to eq(1)
|
||||
Domain.last.nameservers << Fabricate(:nameserver, hostname: 'ns.server.ee', created_at: Time.now - 20)
|
||||
expect(DomainVersion.count).to eq(2)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when removing child' do
|
||||
it('has one domain version before events') { expect(DomainVersion.count).to eq(1) }
|
||||
|
||||
it 'contact creates a version' do
|
||||
expect(DomainVersion.count).to eq(1)
|
||||
DomainContact.last.destroy
|
||||
expect(Domain.last.valid?).to be(true)
|
||||
expect(DomainVersion.count).to eq(2)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'when deleting child' do
|
||||
it 'contact creates a version' do
|
||||
expect(DomainVersion.count).to eq(1)
|
||||
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: []
|
||||
})
|
||||
end
|
||||
|
||||
it 'nameserver creates a version' do
|
||||
Domain.last.nameservers << Fabricate(:nameserver, created_at: Time.now - 30)
|
||||
Domain.last.nameservers.last.destroy
|
||||
expect(DomainVersion.count).to eq(3)
|
||||
expect(Domain.last.nameservers.count).to eq(1)
|
||||
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' }]
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'when editing children' do
|
||||
it 'creates a version' do
|
||||
expect(DomainVersion.count).to eq(1)
|
||||
Contact.find_by(name: 'owner_contact').update_attributes!(name: 'edited owner_contact')
|
||||
expect(DomainVersion.count).to eq(2)
|
||||
end
|
||||
|
||||
it 'creates 3 versions' do
|
||||
expect(DomainVersion.count).to eq(1)
|
||||
Contact.find_by(name: 'owner_contact').update_attributes!(name: 'edited owner_contact')
|
||||
expect(DomainVersion.count).to eq(2)
|
||||
Contact.find_by(name: 'tech_contact 1').update_attributes!(name: 'edited tech_contact')
|
||||
expect(DomainVersion.count).to eq(3)
|
||||
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' }]
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue