mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 20:18:22 +02:00
Add handling of missing disclaimer
This commit is contained in:
parent
396852df53
commit
20d341f2e5
3 changed files with 11 additions and 2 deletions
|
@ -36,7 +36,7 @@ class WhoisRecord < ActiveRecord::Base
|
||||||
registrant = domain.registrant
|
registrant = domain.registrant
|
||||||
|
|
||||||
@disclosed = []
|
@disclosed = []
|
||||||
h[:disclaimer] = disclaimer_text
|
h[:disclaimer] = disclaimer_text if disclaimer_text.present?
|
||||||
h[:name] = domain.name
|
h[:name] = domain.name
|
||||||
h[:status] = domain.statuses.map { |x| status_map[x] || x }
|
h[:status] = domain.statuses.map { |x| status_map[x] || x }
|
||||||
h[:registered] = domain.registered_at.try(:to_s, :iso8601)
|
h[:registered] = domain.registered_at.try(:to_s, :iso8601)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
<%- if json['disclaimer'].present? %>
|
||||||
<%= json['disclaimer'].scan(/\S.{0,72}\S(?=\s|$)|\S+/).join("\n") %>
|
<%= json['disclaimer'].scan(/\S.{0,72}\S(?=\s|$)|\S+/).join("\n") %>
|
||||||
|
|
||||||
|
<%- end %>
|
||||||
Estonia .ee Top Level Domain WHOIS server
|
Estonia .ee Top Level Domain WHOIS server
|
||||||
|
|
||||||
Domain:
|
Domain:
|
||||||
|
|
|
@ -6,6 +6,7 @@ class WhoisRecordTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
@domain = domains(:shop)
|
@domain = domains(:shop)
|
||||||
@record = WhoisRecord.new(domain: @domain)
|
@record = WhoisRecord.new(domain: @domain)
|
||||||
|
@record.populate
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_generated_json_has_expected_values
|
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_contact = Regexp.new(expected_technical_contact, Regexp::MULTILINE)
|
||||||
regexp_disclaimer = Regexp.new(expected_disclaimer, Regexp::MULTILINE)
|
regexp_disclaimer = Regexp.new(expected_disclaimer, Regexp::MULTILINE)
|
||||||
|
|
||||||
@record.populate
|
|
||||||
assert_match(regexp_disclaimer, @record.body)
|
assert_match(regexp_disclaimer, @record.body)
|
||||||
assert_match(regexp_contact, @record.body)
|
assert_match(regexp_contact, @record.body)
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue