Skip to content

Commit

Permalink
Migrate test to rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos committed Mar 8, 2011
1 parent 4b1bd7c commit 4375b6d
Show file tree
Hide file tree
Showing 96 changed files with 2,809 additions and 855 deletions.
2 changes: 2 additions & 0 deletions lib/whois/answer/parser/whois.denic.de.rb
Expand Up @@ -100,6 +100,8 @@ class WhoisDenicDe < Base
contact("Admin-C", Whois::Answer::Contact::TYPE_ADMIN)
end

# FIXME: check against different schema

property_supported :technical_contact do
contact("Tech-C", Whois::Answer::Contact::TYPE_TECHNICAL)
end
Expand Down
2 changes: 2 additions & 0 deletions lib/whois/answer/parser/whois.iana.org.rb
Expand Up @@ -47,6 +47,8 @@ class WhoisIanaOrg < Base
end


# TODO: registrar

property_supported :registrant_contact do
contact("organisation", Whois::Answer::Contact::TYPE_REGISTRANT)
end
Expand Down
16 changes: 8 additions & 8 deletions lib/whois/answer/parser/whois.nic.sn.rb
Expand Up @@ -82,20 +82,20 @@ class WhoisNicSn < Base


property_supported :registrant_contact do
if content_for_scanner =~ /Owner's handle:\s+(.*)\n/
contact($1)
if content_for_scanner =~ /Owner's handle:\s+(.+)\n/
contact($1, Whois::Answer::Contact::TYPE_REGISTRANT)
end
end

property_supported :admin_contact do
if content_for_scanner =~ /Administrative Contact's handle:\s+(.*)\n/
contact($1)
if content_for_scanner =~ /Administrative Contact's handle:\s+(.*+)\n/
contact($1, Whois::Answer::Contact::TYPE_ADMIN)
end
end

property_supported :technical_contact do
if content_for_scanner =~ /Technical Contact's handle:\s+(.*)\n/
contact($1)
if content_for_scanner =~ /Technical Contact's handle:\s+(.+)\n/
contact($1, Whois::Answer::Contact::TYPE_TECHNICAL)
end
end

Expand All @@ -109,8 +109,8 @@ class WhoisNicSn < Base

private

def contact(string)
Whois::Answer::Contact.new(:id => string, :name => string)
def contact(string, type)
Whois::Answer::Contact.new(:type => type, :id => string, :name => string)
end

end
Expand Down
11 changes: 11 additions & 0 deletions spec/fixtures/responses/whois.cnnic.cn/status_available.expected
@@ -0,0 +1,11 @@
#registrar
should: %s == nil

#registrant_contact
should: %s == nil

#admin_contact
should: %s == nil

#technical_contact
should: %s raise_error(Whois::PropertyNotSupported)
22 changes: 22 additions & 0 deletions spec/fixtures/responses/whois.cnnic.cn/status_registered.expected
@@ -0,0 +1,22 @@
#registrar
should: %s be_a(_registrar)
should: %s.id == "MarkMonitor, Inc."
should: %s.name == "MarkMonitor, Inc."
should: %s.organization == nil

#registrant_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_REGISTRANT
should: %s.id == nil
should: %s.name == "Domain Admin"
should: %s.organization == "Google Ireland Holdings"

#admin_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_ADMIN
should: %s.id == nil
should: %s.name == nil
should: %s.email == "dns-admin@google.com"

#technical_contact
should: %s raise_error(Whois::PropertyNotSupported)
11 changes: 11 additions & 0 deletions spec/fixtures/responses/whois.co.pl/status_available.expected
@@ -0,0 +1,11 @@
#registrar
should: %s raise_error(Whois::PropertyNotSupported)

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

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

#technical_contact
should: %s raise_error(Whois::PropertyNotSupported)
11 changes: 11 additions & 0 deletions spec/fixtures/responses/whois.co.pl/status_registered.expected
@@ -0,0 +1,11 @@
#registrar
should: %s raise_error(Whois::PropertyNotSupported)

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

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

#technical_contact
should: %s raise_error(Whois::PropertyNotSupported)
@@ -0,0 +1,11 @@
#registrar
should: %s raise_error(Whois::PropertyNotSupported)

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

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

#technical_contact
should: %s raise_error(Whois::PropertyNotSupported)
@@ -0,0 +1,11 @@
#registrar
should: %s raise_error(Whois::PropertyNotSupported)

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

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

#technical_contact
should: %s raise_error(Whois::PropertyNotSupported)
@@ -0,0 +1,11 @@
#registrar
should: %s == nil

#registrant_contact
should: %s == nil

#admin_contact
should: %s == nil

#technical_contact
should: %s == nil
@@ -0,0 +1,43 @@
#registrar
should: %s be_a(_registrar)
should: %s.id == nil
should: %s.name == "Domain Billing"
should: %s.organization == "MarkMonitor"

#registrant_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_REGISTRANT
should: %s.id == nil
should: %s.name == "Google Inc."
should: %s.city == "Mountain View"
should: %s.zip == "94043"
should: %s.state == nil
should: %s.phone == nil
should: %s.fax == nil
should: %s.email == nil

#admin_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_ADMIN
should: %s.id == nil
should: %s.name == "Lena Tangermann"
should: %s.organization == "Google Germany GmbH"
should: %s.address == "ABC-Strasse 19"
should: %s.city == "Hamburg"
should: %s.zip == "20354"
should: %s.state == nil
should: %s.phone == nil
should: %s.fax == nil
should: %s.email == nil

#technical_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_TECHNICAL
should: %s.id == nil
should: %s.name == "Google Inc."
should: %s.city == "Mountain View"
should: %s.zip == "94043"
should: %s.state == nil
should: %s.phone == "+1-6503300100"
should: %s.fax == "+1-6506188571"
should: %s.email == "dns-admin@google.com"
@@ -0,0 +1,11 @@
#registrar
should: %s == nil

#registrant_contact
should: %s == nil

#admin_contact
should: %s == nil

#technical_contact
should: %s == nil
@@ -0,0 +1,23 @@
#registrar
should: %s be_a(_registrar)
should: %s.id == nil
should: %s.name == "Domain Billing"
should: %s.organization == "MarkMonitor"

#registrant_contact
should: %s == nil

#admin_contact
should: %s == nil

#technical_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_TECHNICAL
should: %s.id == nil
should: %s.name == "Google Inc."
should: %s.city == "Mountain View"
should: %s.zip == "94043"
should: %s.state == nil
should: %s.phone == "+1-6503300100"
should: %s.fax == "+1-6506188571"
should: %s.email == "dns-admin@google.com"
@@ -0,0 +1,11 @@
#registrar
should: %s == nil

#registrant_contact
should: %s == nil

#admin_contact
should: %s == nil

#technical_contact
should: %s == nil
@@ -1,2 +1,30 @@
#registrar
should: %s be_a(_registrar)
should: %s.id == nil
should: %s.name == "Domain Admin"
should: %s.organization == "MarkMonitor Inc"

#registrant_contact
should: %s == nil

#admin_contact
should: %s == nil

#technical_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_TECHNICAL
should: %s.id == nil
should: %s.name == "DNS Admin"
should: %s.organization == "Google Inc."
should: %s.address == "1600 Amphitheatre Parkway"
should: %s.city == "Mountain View"
should: %s.zip == "94043"
should: %s.state == nil
should: %s.country_code == "US"
should: %s.phone == "+1.6502530000"
should: %s.fax == "+1.6506188571"
should: %s.email == "dns-admin@google.com"


#response_throttled?
should: %s == false
@@ -0,0 +1,8 @@
#registrant_contact
should: %s == nil

#admin_contact
should: %s == nil

#technical_contact
should: %s == nil
@@ -0,0 +1,8 @@
#registrant_contact
should: %s == nil

#admin_contact
should: %s == nil

#technical_contact
should: %s == nil
38 changes: 38 additions & 0 deletions spec/fixtures/responses/whois.iana.org/status_registered.expected
@@ -0,0 +1,38 @@
#registrant_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_REGISTRANT
should: %s.id == nil
should: %s.name == nil
should: %s.organization == "North Atlantic Treaty Organization"
should: %s.address == "Blvd Leopold III"
should: %s.city == "1110 Brussels"
should: %s.zip == "Brussels"
should: %s.country == "Belgium"

#admin_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_ADMIN
should: %s.id == nil
should: %s.name == "Aidan Murdock"
should: %s.organization == nil
should: %s.address == "SHAPE"
should: %s.city == "NCSA/SDD/SAL"
should: %s.zip == "Casteau Hainaut 7010"
should: %s.country == "Belgium"
should: %s.phone == "+32 65 44 7244"
should: %s.fax == "+32 65 44 7221"
should: %s.email == "aidan.murdock@ncsa.nato.int"

#technical_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_TECHNICAL
should: %s.id == nil
should: %s.name == "Jack Smits"
should: %s.organization == nil
should: %s.address == "SHAPE"
should: %s.city == "NCSA/SMD"
should: %s.zip == "Casteau Hainaut 7010"
should: %s.country == "Belgium"
should: %s.phone == "+32 65 44 7534"
should: %s.fax == "+32 65 44 7556"
should: %s.email == "jack.smits@ncsa.nato.int"
11 changes: 11 additions & 0 deletions spec/fixtures/responses/whois.nic.ac/status_available.expected
@@ -0,0 +1,11 @@
#registrar
should: %s raise_error(Whois::PropertyNotSupported)

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

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

#technical_contact
should: %s raise_error(Whois::PropertyNotSupported)
11 changes: 11 additions & 0 deletions spec/fixtures/responses/whois.nic.ac/status_registered.expected
@@ -0,0 +1,11 @@
#registrar
should: %s raise_error(Whois::PropertyNotSupported)

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

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

#technical_contact
should: %s raise_error(Whois::PropertyNotSupported)
@@ -0,0 +1,14 @@
#registrant_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_REGISTRANT
should: %s.id == nil
should: %s.name == "Google, Inc."
should: %s.organization == "Google, Inc."
should: %s.address == "Amphitheatre Pkwy 1600."
should: %s.city == "Mountain View"
should: %s.zip == "CA-94043"
should: %s.state == nil
should: %s.country_code == "US"
should: %s.phone == "+1 650 253 0000"
should: %s.fax == "+1 650 253 0001"
should: %s.email == nil
@@ -0,0 +1,14 @@
#registrant_contact
should: %s be_a(_contact)
should: %s.type == Whois::Answer::Contact::TYPE_REGISTRANT
should: %s.id == nil
should: %s.name =~ /Buruzs/
should: %s.organization == nil
should: %s.address == nil
should: %s.city == nil
should: %s.zip == nil
should: %s.state == nil
should: %s.country_code == nil
should: %s.phone == nil
should: %s.fax == nil
should: %s.email == nil
@@ -0,0 +1,7 @@
#registrant_contact
should: %s be_a(_contact)
should: %s.address == nil
should: %s.city == nil
should: %s.zip == nil
should: %s.state == nil
should: %s.country_code == nil

0 comments on commit 4375b6d

Please sign in to comment.