mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 22:54:47 +02:00
Merge branch 'tune-test-env' into registry-792
This commit is contained in:
commit
ae4cae16d2
2 changed files with 16 additions and 12 deletions
|
@ -13,10 +13,15 @@ class ContactIdenticalTest < ActiveSupport::TestCase
|
||||||
]
|
]
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
|
@original_address_processing = Setting.address_processing
|
||||||
@contact = contacts(:william)
|
@contact = contacts(:william)
|
||||||
@identical = contacts(:identical_to_william)
|
@identical = contacts(:identical_to_william)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.address_processing = @original_address_processing
|
||||||
|
end
|
||||||
|
|
||||||
def test_returns_identical
|
def test_returns_identical
|
||||||
assert_equal @identical, @contact.identical(@identical.registrar)
|
assert_equal @identical, @contact.identical(@identical.registrar)
|
||||||
end
|
end
|
||||||
|
@ -33,30 +38,24 @@ class ContactIdenticalTest < ActiveSupport::TestCase
|
||||||
assert_nil @contact.identical(@identical.registrar)
|
assert_nil @contact.identical(@identical.registrar)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_takes_address_into_account_when_processing_enabled
|
def test_takes_address_into_account_when_address_processing_is_on
|
||||||
|
Setting.address_processing = true
|
||||||
|
|
||||||
Contact.address_attribute_names.each do |attribute|
|
Contact.address_attribute_names.each do |attribute|
|
||||||
previous_value = @identical.public_send(attribute)
|
previous_value = @identical.public_send(attribute)
|
||||||
@identical.update_attribute(attribute, 'other')
|
@identical.update_attribute(attribute, 'other')
|
||||||
|
assert_nil @contact.identical(@identical.registrar)
|
||||||
Contact.stub :address_processing?, true do
|
|
||||||
assert_nil @contact.identical(@identical.registrar)
|
|
||||||
end
|
|
||||||
|
|
||||||
@identical.update_attribute(attribute, previous_value)
|
@identical.update_attribute(attribute, previous_value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_ignores_address_when_processing_disabled
|
def test_ignores_address_when_address_processing_is_off
|
||||||
Setting.address_processing = false
|
Setting.address_processing = false
|
||||||
|
|
||||||
Contact.address_attribute_names.each do |attribute|
|
Contact.address_attribute_names.each do |attribute|
|
||||||
previous_value = @identical.public_send(attribute)
|
previous_value = @identical.public_send(attribute)
|
||||||
@identical.update_attribute(attribute, 'other')
|
@identical.update_attribute(attribute, 'other')
|
||||||
|
assert_equal @identical, @contact.identical(@identical.registrar)
|
||||||
Contact.stub :address_processing?, false do
|
|
||||||
assert_equal @identical, @contact.identical(@identical.registrar)
|
|
||||||
end
|
|
||||||
|
|
||||||
@identical.update_attribute(attribute, previous_value)
|
@identical.update_attribute(attribute, previous_value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,14 @@ require 'test_helper'
|
||||||
|
|
||||||
class ContactPostalAddressTest < ActiveSupport::TestCase
|
class ContactPostalAddressTest < ActiveSupport::TestCase
|
||||||
setup do
|
setup do
|
||||||
|
@original_address_processing = Setting.address_processing
|
||||||
@contact = contacts(:john)
|
@contact = contacts(:john)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
Setting.address_processing = @original_address_processing
|
||||||
|
end
|
||||||
|
|
||||||
def test_invalid_if_country_code_is_invalid_and_address_processing_is_on
|
def test_invalid_if_country_code_is_invalid_and_address_processing_is_on
|
||||||
Setting.address_processing = true
|
Setting.address_processing = true
|
||||||
@contact.country_code = 'invalid'
|
@contact.country_code = 'invalid'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue