mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 23:54:44 +02:00
Add tests
This commit is contained in:
parent
647bf4c397
commit
6bab335f5a
4 changed files with 55 additions and 0 deletions
5
test/fixtures/log_contacts.yml
vendored
Normal file
5
test/fixtures/log_contacts.yml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
one:
|
||||||
|
item_id: <%= ActiveRecord::FixtureSet.identify(:john) %>
|
||||||
|
item_type: Contact
|
||||||
|
event: update
|
||||||
|
created_at: <%= Time.zone.parse('2010-07-05') %>
|
8
test/fixtures/log_domains.yml
vendored
Normal file
8
test/fixtures/log_domains.yml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
one:
|
||||||
|
item_id: <%= ActiveRecord::FixtureSet.identify(:shop) %>
|
||||||
|
item_type: Domain
|
||||||
|
event: update
|
||||||
|
object:
|
||||||
|
registrant_id: <%= ActiveRecord::FixtureSet.identify(:john) %>
|
||||||
|
updated_at: <%= Time.zone.parse('2010-07-05') %>
|
||||||
|
created_at: <%= Time.zone.parse('2010-07-05') %>
|
16
test/integration/contact/audit_log_test.rb
Normal file
16
test/integration/contact/audit_log_test.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class ContactAuditLogTest < ActionDispatch::IntegrationTest
|
||||||
|
def test_stores_metadata
|
||||||
|
contact = contacts(:john)
|
||||||
|
|
||||||
|
contact.legal_document_id = 1
|
||||||
|
assert_difference 'contact.versions.count' do
|
||||||
|
contact.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
contact_version = contact.versions.last
|
||||||
|
assert_equal ({ legal_documents: [1] }).with_indifferent_access,
|
||||||
|
contact_version.children.with_indifferent_access
|
||||||
|
end
|
||||||
|
end
|
26
test/integration/domain/audit_log_test.rb
Normal file
26
test/integration/domain/audit_log_test.rb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class DomainAuditLogTest < ActionDispatch::IntegrationTest
|
||||||
|
def test_stores_metadata
|
||||||
|
domain = domains(:shop)
|
||||||
|
assert_equal [contacts(:jane).id], domain.admin_contacts.ids
|
||||||
|
assert_equal [contacts(:william).id, contacts(:acme_ltd).id].sort, domain.tech_contacts.ids.sort
|
||||||
|
assert_equal [nameservers(:shop_ns1).id, nameservers(:shop_ns2).id].sort, domain.nameservers.ids
|
||||||
|
.sort
|
||||||
|
assert_equal contacts(:john).id, domain.registrant_id
|
||||||
|
|
||||||
|
domain.legal_document_id = 1
|
||||||
|
assert_difference 'domain.versions.count' do
|
||||||
|
domain.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
domain_version = domain.versions.last
|
||||||
|
assert_equal ({ admin_contacts: [contacts(:jane).id],
|
||||||
|
tech_contacts: [contacts(:william).id, contacts(:acme_ltd).id],
|
||||||
|
nameservers: [nameservers(:shop_ns1).id, nameservers(:shop_ns2).id],
|
||||||
|
dnskeys: [],
|
||||||
|
legal_documents: [1],
|
||||||
|
registrant: [contacts(:john).id] }).with_indifferent_access,
|
||||||
|
domain_version.children.with_indifferent_access
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue