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
|
@ -62,7 +62,7 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
# archiving
|
# archiving
|
||||||
# if proc works only on changes on domain sadly
|
# 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
|
def new_version
|
||||||
return false if versions.try(:last).try(:snapshot) == create_snapshot
|
return false if versions.try(:last).try(:snapshot) == create_snapshot
|
||||||
|
@ -75,10 +75,10 @@ class Domain < ActiveRecord::Base
|
||||||
touch_with_version if new_version
|
touch_with_version if new_version
|
||||||
end
|
end
|
||||||
|
|
||||||
def track_nameserver_add(nameserver)
|
def track_nameserver_add(_nameserver)
|
||||||
|
return true if versions.count == 0
|
||||||
return true unless valid? && new_version
|
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
|
touch_with_version
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ class DomainContact < ActiveRecord::Base
|
||||||
|
|
||||||
def domain_snapshot
|
def domain_snapshot
|
||||||
return true if domain.nil?
|
return true if domain.nil?
|
||||||
|
return true if domain.versions.count == 0 # avoid snapshot on creation
|
||||||
domain.create_version
|
domain.create_version
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
|
@ -41,6 +41,6 @@ Rails.application.configure do
|
||||||
config.after_initialize do
|
config.after_initialize do
|
||||||
Bullet.enable = true
|
Bullet.enable = true
|
||||||
Bullet.bullet_logger = 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
|
||||||
end
|
end
|
||||||
|
|
|
@ -80,18 +80,6 @@ describe 'EPP Contact', epp: true do
|
||||||
expect(id.text.length).to eq(8)
|
expect(id.text.length).to eq(8)
|
||||||
# 5 seconds for what-ever weird lag reasons might happen
|
# 5 seconds for what-ever weird lag reasons might happen
|
||||||
expect(cr_date.text.to_time).to be_within(5).of(Time.now)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -115,16 +103,6 @@ describe 'EPP Contact', epp: true do
|
||||||
expect(response[:result_code]).to eq('2201')
|
expect(response[:result_code]).to eq('2201')
|
||||||
end
|
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
|
it 'is succesful' do
|
||||||
Fabricate(
|
Fabricate(
|
||||||
:contact,
|
:contact,
|
||||||
|
|
|
@ -7,8 +7,7 @@ end
|
||||||
|
|
||||||
describe Address, '.extract_params' do
|
describe Address, '.extract_params' do
|
||||||
|
|
||||||
# TODO: please fix
|
it 'returns params hash' do
|
||||||
it 'returns params hash', pending: true do
|
|
||||||
Fabricate(:country, iso: 'EE')
|
Fabricate(:country, iso: 'EE')
|
||||||
ph = { postalInfo: { name: 'fred', addr: { cc: 'EE', city: 'Village', street: %w(street1 street2) } } }
|
ph = { postalInfo: { name: 'fred', addr: { cc: 'EE', city: 'Village', street: %w(street1 street2) } } }
|
||||||
expect(Address.extract_attributes(ph[:postalInfo])).to eq({
|
expect(Address.extract_attributes(ph[:postalInfo])).to eq({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue