Fix sporadic errors in tests

#746
This commit is contained in:
Artur Beljajev 2018-03-06 12:13:21 +02:00
parent d42bdfbc0f
commit a910165bc9

View file

@ -34,12 +34,14 @@ class ContactIdenticalTest < ActiveSupport::TestCase
end
def test_takes_address_into_account_when_processing_enabled
Setting.address_processing = true
Contact.address_attribute_names.each do |attribute|
previous_value = @identical.public_send(attribute)
@identical.update_attribute(attribute, 'other')
Contact.stub :address_processing?, true do
assert_nil @contact.identical(@identical.registrar)
end
@identical.update_attribute(attribute, previous_value)
end
end
@ -50,7 +52,11 @@ class ContactIdenticalTest < ActiveSupport::TestCase
Contact.address_attribute_names.each do |attribute|
previous_value = @identical.public_send(attribute)
@identical.update_attribute(attribute, 'other')
Contact.stub :address_processing?, false do
assert_equal @identical, @contact.identical(@identical.registrar)
end
@identical.update_attribute(attribute, previous_value)
end
end