Fixed tests

This commit is contained in:
Andres Keskküla 2014-10-22 12:36:32 +03:00
parent 76e19b7e90
commit f5e7f23ddf
6 changed files with 8 additions and 30 deletions

View file

@ -66,7 +66,7 @@ class Contact < ActiveRecord::Base
def domains_snapshot
(domains + domains_owned).uniq.each do |domain|
next unless domain.is_a?(Domain)
#next if domain.versions.last == domain.create_snapshot
# next if domain.versions.last == domain.create_snapshot
domain.create_version # Method from paper_trail
end
end

View file

@ -62,7 +62,7 @@ class Domain < ActiveRecord::Base
# archiving
# if proc works only on changes on domain sadly
has_paper_trail class_name: 'DomainVersion', meta: { snapshot: :create_snapshot }, if: Proc.new{ |t| t.new_version }
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
@ -75,10 +75,10 @@ class Domain < ActiveRecord::Base
touch_with_version if new_version
end
def track_nameserver_add(nameserver)
def track_nameserver_add(_nameserver)
return true if versions.count == 0
return true unless valid? && new_version
ns_created = nameserver.created_at.to_i
return true if created_at.to_i.between?( ns_created, ns_created + 1 )
touch_with_version
end

View file

@ -40,6 +40,7 @@ class DomainContact < ActiveRecord::Base
def domain_snapshot
return true if domain.nil?
return true if domain.versions.count == 0 # avoid snapshot on creation
domain.create_version
true
end