Refactored whois from domain into whois body

This commit is contained in:
Priit Tark 2015-04-22 10:39:52 +03:00
parent 920b3e71e0
commit 3d0d98d9b1
7 changed files with 204 additions and 51 deletions

View file

@ -38,6 +38,9 @@ describe Domain do
@domain.whois_body.should == nil
end
it 'should not have whois json' do
@domain.whois_json.should == nil
end
end
context 'with valid attributes' do
@ -74,10 +77,85 @@ describe Domain do
domain.errors.full_messages.should match_array(["Admin domain contacts is invalid"])
end
it 'should not have whois_body present by default' do
it 'should have whois body by default' do
@domain.whois_body.present?.should == true
end
it 'should have whois json by default' do
@domain.whois_json.present?.should == true
end
it 'should have whois_body present by default' do
@domain.name = 'yeah.ee'
@domain.updated_at = Time.zone.parse('2020.02.02 02:00')
@domain.registered_at = Time.zone.parse('2000.01.01 9:00')
@domain.valid_to = Time.zone.parse('2016.04.21 0:00')
registrar = Fabricate(:registrar,
name: 'First Registrar Ltd',
created_at: Time.zone.parse('1995.01.01'),
updated_at: Time.zone.parse('1996.01.01'))
@domain.registrant = Fabricate(:contact,
name: 'Jarren Jakubowski0',
created_at: Time.zone.parse('2005.01.01'))
@domain.admin_contacts = [Fabricate(:contact,
name: 'First Admin',
registrar: registrar,
created_at: Time.zone.parse('2016.01.01'))]
@domain.tech_contacts = [Fabricate(:contact,
name: 'First Tech',
registrar: registrar,
created_at: Time.zone.parse('2016.01.01'))]
@domain.registrar = registrar
ns1 = Fabricate(:nameserver, hostname: 'test.ee')
ns1.updated_at = Time.zone.parse('1980.01.01')
ns2 = Fabricate(:nameserver, hostname: 'test1.ee')
ns2.updated_at = Time.zone.parse('1970.01.01')
@domain.nameservers = [ns1, ns2]
@domain.update_whois_body
@domain.whois_body.should == <<-EOS
Estonia .ee Top Level Domain WHOIS server
Domain:
name: yeah.ee
registrant: Jarren Jakubowski0
status: ok (paid and in zone)
registered: 2000-01-01 09:00:00 UTC
changed: 2020-02-02 02:00:00 UTC
expire: 2016-04-21 00:00:00 UTC
outzone:
delete:
Administrative contact
name: First Admin
e-mail: Not Disclosed - Visit www.internet.ee for webbased WHOIS
registrar: First Registrar Ltd
created: 2016-01-01 00:00:00
Technical contact:
name: First Tech
e-mail: Not Disclosed - Visit www.internet.ee for webbased WHOIS
registrar: First Registrar Ltd
created: 2016-01-01 00:00:00
Registrar:
name: First Registrar Ltd
phone:
address: Street 999, Town, County, Postal
changed: 1996-01-01 00:00:00
Name servers:
nserver: test.ee
changed: 1980-01-01 00:00:00
nserver: test1.ee
changed: 1970-01-01 00:00:00
Estonia .ee Top Level Domain WHOIS server
More information at http://internet.ee
EOS
end
context 'with versioning' do
it 'should not have one version' do
with_versioning do