whois.rnids.rs parser crashes when domain is private. #163

Merged
merged 1 commit into from May 11, 2012
View
5 lib/whois/record/scanners/whois.rnids.rs.rb
@@ -26,6 +26,7 @@ class WhoisRnidsRs < Base
:scan_group_keyvalue,
:flag_group_end,
:skip_empty_line,
+ :skip_privacy,
]
@@ -68,6 +69,10 @@ class WhoisRnidsRs < Base
@input.skip(/^%.*\n/)
end
+ tokenizer :skip_privacy do
+ @input.skip(/^Whois privacy has been activated for domain.\n/)
+ end
+
end
end
View
11 spec/fixtures/responses/whois.rnids.rs/token_whois_privacy.expected
@@ -0,0 +1,11 @@
+#registrant_contacts
+ should: %s CLASS(array)
+ should: %s == []
+
+#admin_contacts
+ should: %s CLASS(array)
+ should: %s == []
+
+#technical_contacts
+ should: %s CLASS(array)
+ should: %s == []
View
36 spec/fixtures/responses/whois.rnids.rs/token_whois_privacy.txt
@@ -0,0 +1,36 @@
+%
+%This is the RNIDS Whois server.
+%
+% Date Format : DD.MM.YYYY
+% Whois Server Version: 1.0.0
+%
+% Rights restricted by copyright.
+% See http://www.rnids.rs/whois_en
+%
+%
+%
+% Ovo je odgovor od RNIDS Whois servera.
+%
+% Format datuma : DD.MM.YYYY
+% Verzija Whois Servera : 1.0.0
+%
+% Sva prava zadržana. Za više informacija.
+% pogledajte http://www.rnids.rs/whois_sr
+
+Domain name: eg.rs.
+Domain status: Active
+Registration date: 22.10.2010 10:20:31
+Modification date: 08.08.2011 11:13:00
+Expiration date: 22.10.2012 10:20:31
+Registrar: GAMA Electronics d.o.o.
+
+
+Whois privacy has been activated for domain.
+
+
+DNS: bits-hq.bitsyu.net. - 217.24.17.10
+DNS: largo.bitsyu.net. - 217.24.17.80
+
+
+
+
View
42 spec/whois/record/parser/responses/whois.rnids.rs/token_whois_privacy_spec.rb
@@ -0,0 +1,42 @@
+# 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.rnids.rs/token_whois_privacy.expected
+#
+# and regenerate the tests with the following rake task
+#
+# $ rake spec:generate
+#
+
+require 'spec_helper'
+require 'whois/record/parser/whois.rnids.rs.rb'
+
+describe Whois::Record::Parser::WhoisRnidsRs, "token_whois_privacy.expected" do
+
+ before(:each) do
+ file = fixture("responses", "whois.rnids.rs/token_whois_privacy.txt")
+ part = Whois::Record::Part.new(:body => File.read(file))
+ @parser = klass.new(part)
+ end
+
+ describe "#registrant_contacts" do
+ it do
+ @parser.registrant_contacts.should be_a(Array)
+ @parser.registrant_contacts.should == []
+ end
+ end
+ describe "#admin_contacts" do
+ it do
+ @parser.admin_contacts.should be_a(Array)
+ @parser.admin_contacts.should == []
+ end
+ end
+ describe "#technical_contacts" do
+ it do
+ @parser.technical_contacts.should be_a(Array)
+ @parser.technical_contacts.should == []
+ end
+ end
+end