Skip to content

Commit

Permalink
In ua parser and tests reordered properties priority in canonical way
Browse files Browse the repository at this point in the history
  • Loading branch information
Uko committed Jun 13, 2012
1 parent 11a4102 commit cf936a1
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 27 deletions.
31 changes: 17 additions & 14 deletions lib/whois/record/parser/whois.ua.rb
Expand Up @@ -19,6 +19,20 @@ class Parser
# @since 2.4.0
class WhoisUa < Base

property_supported :domain do
if content_for_scanner =~ /domain:\s+(.+)\n/
$1
end
end

property_not_supported :domain_id


property_not_supported :referral_whois

property_not_supported :referral_url


property_supported :status do
if content_for_scanner =~ /status:\s+(.+?)\n/
case s = $1.downcase
Expand All @@ -40,17 +54,6 @@ class WhoisUa < Base
!available?
end

property_supported :domain do
if content_for_scanner =~ /domain:\s+(.+)\n/
$1
end
end

property_not_supported :domain_id

property_not_supported :referral_whois

property_not_supported :referral_url

property_supported :created_on do
if content_for_scanner =~ /created:\s+(.+)\n/
Expand All @@ -73,9 +76,9 @@ class WhoisUa < Base
end
end


property_not_supported :registrar


property_not_supported :registrant_contacts

property_supported :admin_contacts do
Expand All @@ -93,8 +96,8 @@ class WhoisUa < Base
end
end

private


private

def build_contact(element, type)
record = []
Expand Down
Expand Up @@ -4,12 +4,14 @@
#domain_id
should: %s raise_error(Whois::PropertyNotSupported)


#referral_whois
should: %s raise_error(Whois::PropertyNotSupported)

#referral_url
should: %s raise_error(Whois::PropertyNotSupported)


#status
should: %s == :registered

Expand Down Expand Up @@ -95,6 +97,7 @@
should: %s[1].created_on == nil
should: %s[1].updated_on == Time.parse("2011-12-15 11:33:14")


#nameservers
should: %s CLASS(array)
should: %s SIZE(2)
Expand Down
9 changes: 6 additions & 3 deletions spec/fixtures/responses/whois.ua/status_available.expected
Expand Up @@ -4,12 +4,14 @@
#domain_id
should: %s raise_error(Whois::PropertyNotSupported)


#referral_whois
should: %s raise_error(Whois::PropertyNotSupported)

#referral_url
should: %s raise_error(Whois::PropertyNotSupported)


#status
should: %s == :available

Expand All @@ -29,6 +31,10 @@
#expires_on
should: %s == nil


#registrar
should: %s raise_error(Whois::PropertyNotSupported)

#registrant_contacts
should: %s raise_error(Whois::PropertyNotSupported)

Expand All @@ -40,9 +46,6 @@
should: %s CLASS(array)
should: %s == []

#registrar
should: %s raise_error(Whois::PropertyNotSupported)


#nameservers
should: %s CLASS(array)
Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/responses/whois.ua/status_registered.expected
Expand Up @@ -4,12 +4,14 @@
#domain_id
should: %s raise_error(Whois::PropertyNotSupported)


#referral_whois
should: %s raise_error(Whois::PropertyNotSupported)

#referral_url
should: %s raise_error(Whois::PropertyNotSupported)


#status
should: %s == :registered

Expand Down Expand Up @@ -79,6 +81,7 @@
should: %s[0].created_on == nil
should: %s[0].updated_on == Time.parse("2012-02-01 21:09:42")


#nameservers
should: %s CLASS(array)
should: %s SIZE(4)
Expand Down
Expand Up @@ -71,6 +71,11 @@
@parser.expires_on.should == nil
end
end
describe "#registrar" do
it do
lambda { @parser.registrar }.should raise_error(Whois::PropertyNotSupported)
end
end
describe "#registrant_contacts" do
it do
lambda { @parser.registrant_contacts }.should raise_error(Whois::PropertyNotSupported)
Expand All @@ -88,11 +93,6 @@
@parser.technical_contacts.should == []
end
end
describe "#registrar" do
it do
lambda { @parser.registrar }.should raise_error(Whois::PropertyNotSupported)
end
end
describe "#nameservers" do
it do
@parser.nameservers.should be_a(Array)
Expand Down
Expand Up @@ -71,6 +71,11 @@
@parser.expires_on.should == nil
end
end
describe "#registrar" do
it do
lambda { @parser.registrar }.should raise_error(Whois::PropertyNotSupported)
end
end
describe "#registrant_contacts" do
it do
lambda { @parser.registrant_contacts }.should raise_error(Whois::PropertyNotSupported)
Expand All @@ -88,11 +93,6 @@
@parser.technical_contacts.should == []
end
end
describe "#registrar" do
it do
lambda { @parser.registrar }.should raise_error(Whois::PropertyNotSupported)
end
end
describe "#nameservers" do
it do
@parser.nameservers.should be_a(Array)
Expand Down

0 comments on commit cf936a1

Please sign in to comment.