Add handling of missing disclaimer

This commit is contained in:
Maciej Szlosarczyk 2018-04-26 12:18:03 +03:00
parent 396852df53
commit 20d341f2e5
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
3 changed files with 11 additions and 2 deletions

View file

@ -6,6 +6,7 @@ class WhoisRecordTest < ActiveSupport::TestCase
@domain = domains(:shop)
@record = WhoisRecord.new(domain: @domain)
@record.populate
end
def test_generated_json_has_expected_values
@ -46,8 +47,14 @@ class WhoisRecordTest < ActiveSupport::TestCase
regexp_contact = Regexp.new(expected_technical_contact, Regexp::MULTILINE)
regexp_disclaimer = Regexp.new(expected_disclaimer, Regexp::MULTILINE)
@record.populate
assert_match(regexp_disclaimer, @record.body)
assert_match(regexp_contact, @record.body)
end
def test_whois_record_has_no_disclaimer_if_Setting_is_blank
Setting.stubs(:registry_whois_disclaimer, '') do
refute(@record.json['disclaimer'])
refute_match(/Search results may not be used for commercial/, @record.body)
end
end
end