Style fixes

This commit is contained in:
Andres Keskküla 2014-10-16 12:01:34 +03:00
parent cb37ddf96d
commit 58077a7989
3 changed files with 3 additions and 29 deletions

View file

@ -62,9 +62,6 @@ class Domain < ActiveRecord::Base
# archiving # archiving
has_paper_trail class_name: 'DomainVersion', meta: { snapshot: :create_snapshot } has_paper_trail class_name: 'DomainVersion', meta: { snapshot: :create_snapshot }
# TODO Add touch_with_version hook to the DomainContact as well to track add/delete(?) of contact
# Not sure what hook to use since Contact.destroy fires update from here so possibly after_create
def create_snapshot def create_snapshot
oc = owner_contact.snapshot if owner_contact.is_a?(Contact) oc = owner_contact.snapshot if owner_contact.is_a?(Contact)
{ {
@ -290,27 +287,4 @@ class Domain < ActiveRecord::Base
return period.to_i.years if unit == 'y' return period.to_i.years if unit == 'y'
end end
end end
private
# for archiving
# def version_owner
# return nil unless owner_contact
# owner_contact.id
# end
# def version_admin_contacts
# return nil unless admin_contacts
# return admin_contacts.map { |ns| ns.id }
# end
# def version_tech_contacts
# return nil unless tech_contacts
# return tech_contacts.map { |ns| ns.id }
# end
# def version_nameservers
# return nil unless nameservers
# return nameservers.map { |ns| ns.id }
# end
end end

View file

@ -5,7 +5,7 @@ class DomainContact < ActiveRecord::Base
after_create :domain_snapshot after_create :domain_snapshot
after_destroy :domain_snapshot after_destroy :domain_snapshot
# after_save :domain_snapshot # after_save :domain_snapshot
attr_accessor :value_typeahead attr_accessor :value_typeahead

View file

@ -64,11 +64,11 @@ describe DomainVersion do
end end
context 'when removing child' do context 'when removing child' do
it('has one domain version before events'){ expect(DomainVersion.count).to eq(1) } it('has one domain version before events') { expect(DomainVersion.count).to eq(1) }
before(:each) { Domain.last.nameservers << Fabricate(:nameserver) } before(:each) { Domain.last.nameservers << Fabricate(:nameserver) }
it 'contact creates a version' do it 'contact creates a version' do
# FIXME For some reason nameservers disappeared mid-test, but randomly stopped happening # FIXME: For some reason nameservers disappeared mid-test, but randomly stopped happening
expect(DomainVersion.count).to eq(1) expect(DomainVersion.count).to eq(1)
DomainContact.last.destroy DomainContact.last.destroy
expect(Domain.last.valid?).to be(true) expect(Domain.last.valid?).to be(true)