mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 08:52:04 +02:00
parent
90ed23f64d
commit
b6ecae6a35
41 changed files with 1239 additions and 61 deletions
16
test/models/contact/address_test.rb
Normal file
16
test/models/contact/address_test.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ContactAddressTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@address = Contact::Address.new('Main Street', '1234', 'NY City', 'NY State', 'US')
|
||||
end
|
||||
|
||||
def test_equal_when_all_parts_are_the_same
|
||||
assert_equal @address, Contact::Address.new('Main Street', '1234', 'NY City', 'NY State', 'US')
|
||||
end
|
||||
|
||||
def test_not_equal_when_some_part_is_different
|
||||
assert_not_equal @address, Contact::Address.new('Main Street', '1234', 'NY City', 'NY State',
|
||||
'DE')
|
||||
end
|
||||
end
|
|
@ -26,4 +26,16 @@ class ContactTest < ActiveSupport::TestCase
|
|||
def test_not_in_use_if_acts_as_neither_registrant_nor_domain_contact
|
||||
refute contacts(:not_in_use).in_use?
|
||||
end
|
||||
|
||||
def test_managed_when_identity_codes_match
|
||||
contact = Contact.new(ident: '1234')
|
||||
user = RegistrantUser.new(registrant_ident: 'US-1234')
|
||||
assert contact.managed_by?(user)
|
||||
end
|
||||
|
||||
def test_unmanaged_when_identity_codes_do_not_match
|
||||
contact = Contact.new(ident: '1234')
|
||||
user = RegistrantUser.new(registrant_ident: 'US-12345')
|
||||
assert_not contact.managed_by?(user)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,4 +21,13 @@ class ContactPostalAddressTest < ActiveSupport::TestCase
|
|||
@contact.country_code = 'invalid'
|
||||
assert @contact.valid?
|
||||
end
|
||||
|
||||
def test_state_is_optional_when_address_is_enabled
|
||||
Setting.address_processing = true
|
||||
contact = contacts(:william)
|
||||
assert contact.valid?
|
||||
|
||||
contact.state = ''
|
||||
assert contact.valid?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue