Make whois JSON test order independent

The test relied on nameservers being inserted in specific order. For
whatever reason, that order can change, but it does not make the
record invalid.

[ns1.google.com, ns2.google.com] is semantically equal to
[ns2.google.com, ns1.google.com]
This commit is contained in:
Maciej Szlosarczyk 2018-09-03 19:08:14 +03:00
parent 39fe8ef6ce
commit f0473825e4
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765

View file

@ -22,7 +22,6 @@ class WhoisRecordTest < ActiveSupport::TestCase
registrant_kind: 'priv',
email: 'john@inbox.test',
expire: '2010-07-05',
nameservers: ['ns1.bestnames.test', 'ns2.bestnames.test'],
registrar_address: 'Main Street, New York, New York, 12345',
dnssec_keys: [],
}
@ -30,6 +29,10 @@ class WhoisRecordTest < ActiveSupport::TestCase
expected_partial_hash.each do |key, value|
assert_equal(value, @record.generated_json[key])
end
['ns1.bestnames.test', 'ns2.bestnames.test'].each do |item|
assert(@record.generated_json[:nameservers].include?(item))
end
end
def test_generated_body_has_justified_disclaimer