Skip to content

Commit

Permalink
whois.ati.tn crashes when contact update is "None"
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos committed Feb 26, 2014
1 parent 57439f7 commit febbd29
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -15,6 +15,8 @@

- FIXED: whois.nic.cx crashes when update date is empty.

- FIXED: whois.ati.tn crashes when contact update is "None".

- CHANGED: Updated whois.nic.ec parser to the new response format.

- CHANGED: Updated whois.pandi.or.id parser to the new response format.
Expand Down
17 changes: 8 additions & 9 deletions lib/whois/record/parser/whois.ati.tn.rb
Expand Up @@ -99,15 +99,14 @@ class WhoisAtiTn < Base
def build_contact(element, type)
node("#{element} Name") do
Record::Contact.new(
:type => type,
:id => nil,
:name => node("#{element} Name"),
:address => node("#{element} Address"),
:phone => node("#{element} Tel"),
:fax => node("#{element} Fax"),
:email => node("#{element} Email"),
:created_on => node("#{element} Created") { |value| Time.parse(value) },
:updated_on => node("#{element} Updated") { |value| Time.parse(value) }
type: type,
name: node("#{element} Name"),
address: node("#{element} Address"),
phone: node("#{element} Tel"),
fax: node("#{element} Fax"),
email: node("#{element} Email"),
created_on: node("#{element} Created") { |value| Time.parse(value) },
updated_on: node("#{element} Updated") { |value| Time.parse(value) if value != "None" }
)
end
end
Expand Down
@@ -0,0 +1,8 @@
#registrant_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
%s[0].type == Whois::Record::Contact::TYPE_REGISTRANT
%s[0].name == "MAISON DE BIEN HOTELIERS ET EQ Farhat Riadh"
%s[0].created_on %TIME{2013-12-13 20:00:57}
%s[0].updated_on == nil
@@ -0,0 +1,34 @@
All rights reserved.
Copyright "Tunisian Internet Agency - http://whois.tn"

Domain : equipements-pro.com.tn
Acivated : 2013-12-13 22:15:08
Registrar : I-HOSTERS

NameServers : ns.steerbook.com. [91.121.103.174]
NameServers : dns.steerbook.com. [46.105.59.229]

Owner Name : MAISON DE BIEN HOTELIERS ET EQ Farhat Riadh
Owner Address : complexe commercial Boukris 2 rue Om Larayes
Owner Tel : 98639096
Owner Fax :
Owner Email : mbh@tunet.tn
Owner Created : 2013-12-13 20:00:57
Owner Updated : None

Admin. Name : MAISON DE BIEN HOTELIERS ET EQ Farhat Riadh
Admin. Address : complexe commercial Boukris 2 rue Om Larayes
Admin. Tel : 98639096
Admin. Fax :
Admin. Email : mbh@tunet.tn
Admin. Created : 2013-12-13 20:00:57
Admin. Updated : None

Tech. Name : MAISON DE BIEN HOTELIERS ET EQ Farhat Riadh
Tech. Address : complexe commercial Boukris 2 rue Om Larayes
Tech. Tel : 98639096
Tech. Fax :
Tech. Email : mbh@tunet.tn
Tech. Created : 2013-12-13 20:00:57
Tech. Updated : None

@@ -0,0 +1,35 @@
# encoding: utf-8

# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# /spec/fixtures/responses/whois.ati.tn/property_contact_updated_none.expected
#
# and regenerate the tests with the following rake task
#
# $ rake spec:generate
#

require 'spec_helper'
require 'whois/record/parser/whois.ati.tn.rb'

describe Whois::Record::Parser::WhoisAtiTn, "property_contact_updated_none.expected" do

subject do
file = fixture("responses", "whois.ati.tn/property_contact_updated_none.txt")
part = Whois::Record::Part.new(body: File.read(file))
described_class.new(part)
end

describe "#registrant_contacts" do
it do
expect(subject.registrant_contacts).to be_a(Array)
expect(subject.registrant_contacts).to have(1).items
expect(subject.registrant_contacts[0]).to be_a(Whois::Record::Contact)
expect(subject.registrant_contacts[0].type).to eq(Whois::Record::Contact::TYPE_REGISTRANT)
expect(subject.registrant_contacts[0].name).to eq("MAISON DE BIEN HOTELIERS ET EQ Farhat Riadh")
expect(subject.registrant_contacts[0].created_on).to eq(Time.parse("2013-12-13 20:00:57"))
expect(subject.registrant_contacts[0].updated_on).to eq(nil)
end
end
end

0 comments on commit febbd29

Please sign in to comment.