mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Fixed tests
This commit is contained in:
parent
76e19b7e90
commit
f5e7f23ddf
6 changed files with 8 additions and 30 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -41,6 +41,6 @@ Rails.application.configure do
|
|||
config.after_initialize do
|
||||
Bullet.enable = true
|
||||
Bullet.bullet_logger = true
|
||||
Bullet.raise = false # raise an error if n+1 query occurs
|
||||
Bullet.raise = true # raise an error if n+1 query occurs
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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,8 +7,7 @@ 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({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue