Skip to content

Commit

Permalink
Create one contact per email (whois.ripn.net)
Browse files Browse the repository at this point in the history
  • Loading branch information
semaperepelitsa committed Mar 20, 2011
1 parent fca7a35 commit 045232e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/whois/record/parser/whois.ripn.net.rb
Expand Up @@ -67,15 +67,14 @@ class WhoisRipnNet < Base


property_supported :admin_contacts do
if content_for_scanner =~ /e-mail:\s+(.+)\n/
content_for_scanner.scan(/e-mail:\s+(.+)\n/).flatten.map do |email|
Record::Contact.new(
:type => Record::Contact::TYPE_ADMIN,
:name => content_for_scanner[/person:\s+(.+)\n/, 1],
:organization => content_for_scanner[/org:\s+(.+)\n/, 1],
:phone => content_for_scanner[/phone:\s+(.+)\n/, 1],
:fax => content_for_scanner[/fax-no:\s+(.+)\n/, 1],
# Return the first matched email, even if there are a few of them
:email => content_for_scanner[/e-mail:\s+(.+)\n/, 1]
:email => email
)
end
end
Expand Down
Expand Up @@ -31,7 +31,7 @@

#admin_contacts
should: %s be_a(Array)
should: %s have(1).items
should: %s have(2).items
should: %s[0] be_a(_contact)
should: %s[0].type == Whois::Record::Contact::TYPE_ADMIN
should: %s[0].id == nil
Expand All @@ -40,6 +40,13 @@
should: %s[0].phone == "+1 650 330 0100"
should: %s[0].fax == "+1 650 618 8571"
should: %s[0].email == "dns-admin@google.com"
should: %s[1].type == Whois::Record::Contact::TYPE_ADMIN
should: %s[1].id == nil
should: %s[1].name == nil
should: %s[1].organization == "Google Inc"
should: %s[1].phone == "+1 650 330 0100"
should: %s[1].fax == "+1 650 618 8571"
should: %s[1].email == "ccops@markmonitor.com"

#technical_contacts
should: %s raise_error(Whois::PropertyNotSupported)
Expand Down
Expand Up @@ -69,7 +69,7 @@
context "#admin_contacts" do
it do
@parser.admin_contacts.should be_a(Array)
@parser.admin_contacts.should have(1).items
@parser.admin_contacts.should have(2).items
@parser.admin_contacts[0].should be_a(_contact)
@parser.admin_contacts[0].type.should == Whois::Record::Contact::TYPE_ADMIN
@parser.admin_contacts[0].id.should == nil
Expand All @@ -78,6 +78,13 @@
@parser.admin_contacts[0].phone.should == "+1 650 330 0100"
@parser.admin_contacts[0].fax.should == "+1 650 618 8571"
@parser.admin_contacts[0].email.should == "dns-admin@google.com"
@parser.admin_contacts[1].type.should == Whois::Record::Contact::TYPE_ADMIN
@parser.admin_contacts[1].id.should == nil
@parser.admin_contacts[1].name.should == nil
@parser.admin_contacts[1].organization.should == "Google Inc"
@parser.admin_contacts[1].phone.should == "+1 650 330 0100"
@parser.admin_contacts[1].fax.should == "+1 650 618 8571"
@parser.admin_contacts[1].email.should == "ccops@markmonitor.com"
end
end
context "#technical_contacts" do
Expand Down

0 comments on commit 045232e

Please sign in to comment.