jm81-whois 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/.gitignore +10 -0
  2. data/LICENSE +1020 -1020
  3. data/README.md +0 -0
  4. data/Rakefile +2 -0
  5. data/{ruby-whois.gemspec → jm81-whois.gemspec} +34 -27
  6. data/lib/whois/domain/aero.rb +16 -16
  7. data/lib/whois/domain/afilias.rb +15 -15
  8. data/lib/whois/domain/base.rb +21 -1
  9. data/lib/whois/domain/cat.rb +19 -19
  10. data/lib/whois/domain/coop.rb +1 -1
  11. data/lib/whois/domain/cz.rb +31 -0
  12. data/lib/whois/domain/educause.rb +42 -42
  13. data/lib/whois/domain/gov.rb +26 -26
  14. data/lib/whois/domain/int.rb +23 -32
  15. data/lib/whois/domain/mobi.rb +15 -15
  16. data/lib/whois/domain/museum.rb +19 -19
  17. data/lib/whois/domain/name.rb +22 -22
  18. data/lib/whois/domain/neustar.rb +0 -0
  19. data/lib/whois/domain/pro.rb +23 -23
  20. data/lib/whois/domain/public_interest.rb +14 -14
  21. data/lib/whois/domain/ru.rb +17 -0
  22. data/lib/whois/domain/su.rb +17 -0
  23. data/lib/whois/domain/verisign_grs.rb +63 -29
  24. data/lib/whois/domain/ws.rb +34 -30
  25. data/lib/whois/domain.rb +18 -18
  26. data/lib/whois/version.rb +3 -0
  27. data/lib/whois.rb +11 -9
  28. data/test/test_helper.rb +0 -0
  29. data/test/whois/domain/aero_test.rb +24 -24
  30. data/test/whois/domain/afilias_test.rb +24 -24
  31. data/test/whois/domain/cat_test.rb +28 -28
  32. data/test/whois/domain/coop_test.rb +28 -28
  33. data/test/whois/domain/educause_test.rb +24 -24
  34. data/test/whois/domain/gov_test.rb +28 -28
  35. data/test/whois/domain/int_test.rb +24 -24
  36. data/test/whois/domain/mobi_test.rb +24 -24
  37. data/test/whois/domain/museum_test.rb +28 -28
  38. data/test/whois/domain/name_test.rb +24 -24
  39. data/test/whois/domain/neustar_test.rb +135 -134
  40. data/test/whois/domain/pro_test.rb +27 -27
  41. data/test/whois/domain/public_interest_test.rb +88 -75
  42. data/test/whois/domain/verisign_grs_test.rb +90 -90
  43. data/test/whois/domain/ws_test.rb +24 -24
  44. data/test/whois/domain_test.rb +0 -0
  45. metadata +35 -19
  46. data/VERSION +0 -1
@@ -1,24 +1,24 @@
1
- class Whois::Domain::Pro < Whois::Domain::Base
2
- HOST = "whois.registrypro.pro"
3
- ATTR_MATCH = /^([^:]+):\W*(.*)\r$/
4
- responds_to :pro
5
-
6
- ATTR_NAMES = {
7
- :registrar_name => "Sponsoring Registrar",
8
- :created_on => "Created On",
9
- :updated_on => "Last Updated On",
10
- :expires_on => "Expiration Date"
11
- }
12
-
13
- def status
14
- attrs["Status"] ? attrs["Status"][0].split(",").collect{|d| d.strip} : nil
15
- end
16
-
17
- def register_url
18
- "http://www.registrypro.pro/partners_findaregistrar.htm"
19
- end
20
-
21
- def available?
22
- @raw =~ /^No match/
23
- end
1
+ class Whois::Domain::Pro < Whois::Domain::Base
2
+ HOST = "whois.registrypro.pro"
3
+ ATTR_MATCH = /^([^:]+):\W*(.*)\r$/
4
+ responds_to :pro
5
+
6
+ ATTR_NAMES = {
7
+ :registrar_name => "Sponsoring Registrar",
8
+ :created_on => "Created On",
9
+ :updated_on => "Last Updated On",
10
+ :expires_on => "Expiration Date"
11
+ }
12
+
13
+ def status
14
+ attrs["Status"] ? attrs["Status"][0].split(",").collect{|d| d.strip} : nil
15
+ end
16
+
17
+ def register_url
18
+ "http://www.registrypro.pro/partners_findaregistrar.htm"
19
+ end
20
+
21
+ def available?
22
+ @raw =~ /^No match/
23
+ end
24
24
  end
@@ -1,15 +1,15 @@
1
- class Whois::Domain::PublicInterest < Whois::Domain::Base
2
- HOST = "whois.pir.org"
3
- ATTR_MATCH = /^([^:]+):(\S.*)\r$/
4
- responds_to :org
5
-
6
- ATTR_NAMES = {
7
- :registrar_name => "Sponsoring Registrar",
8
- :created_on => "Created On",
9
- :updated_on => "Last Updated On"
10
- }
11
-
12
- def available?
13
- @raw =~ /NOT FOUND/
14
- end
1
+ class Whois::Domain::PublicInterest < Whois::Domain::Base
2
+ HOST = "whois.pir.org"
3
+ ATTR_MATCH = /^([^:]+):(\S.*)\r$/
4
+ responds_to :org
5
+
6
+ ATTR_NAMES = {
7
+ :registrar_name => "Sponsoring Registrar",
8
+ :created_on => "Created On",
9
+ :updated_on => "Last Updated On"
10
+ }
11
+
12
+ def available?
13
+ @raw =~ /NOT FOUND/
14
+ end
15
15
  end
@@ -0,0 +1,17 @@
1
+ class Whois::Domain::Ru < Whois::Domain::Base
2
+ HOST = "whois.ripn.net"
3
+ ATTR_MATCH = /\s*([^:]+):\s+(.*)$/
4
+ responds_to :ru
5
+
6
+ ATTR_NAMES = {
7
+ :registrar_name => "Registrar Name",
8
+ :whois_server => "Registrar Whois",
9
+ :created_on => "Domain Created",
10
+ :updated_on => "Domain Last Updated",
11
+ :expires_on => "Domain Currently Expires"
12
+ }
13
+
14
+ def available?
15
+ @raw =~ /NOT FOUND/
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ class Whois::Domain::Su < Whois::Domain::Base
2
+ HOST = "whois.ripn.net"
3
+ ATTR_MATCH = /\s*([^:]+):\s+(.*)$/
4
+ responds_to :su
5
+
6
+ ATTR_NAMES = {
7
+ :registrar_name => "Registrar Name",
8
+ :whois_server => "Registrar Whois",
9
+ :created_on => "Domain Created",
10
+ :updated_on => "Domain Last Updated",
11
+ :expires_on => "Domain Currently Expires"
12
+ }
13
+
14
+ def available?
15
+ @raw =~ /NOT FOUND/
16
+ end
17
+ end
@@ -1,29 +1,63 @@
1
- class Whois::Domain::VerisignGrs < Whois::Domain::Base
2
- HOST = "whois.verisign-grs.com"
3
- ATTR_MATCH = /^ ([^:]+):\W*(.*)$/
4
- responds_to :com, :net, :jobs, :tv
5
-
6
- def host
7
- case @name.match(/.*\.([^\.]+)$/)[1]
8
- when 'jobs' then "jobswhois.verisign-grs.com"
9
- when 'tv' then "tvwhois.verisign-grs.com"
10
- else "whois.verisign-grs.com"
11
- end
12
- end
13
-
14
- # For best results, this use object = name format.
15
- # e.g. domain = john.smith.name
16
- def query_string
17
- "domain = #{@name}\n"
18
- end
19
-
20
- def database_updated_at
21
- if(@raw =~ /Last update of whois database: ([^<]*)/)
22
- Time.parse($1)
23
- end
24
- end
25
-
26
- def available?
27
- @raw =~ /^No match for/
28
- end
29
- end
1
+ class Whois::Domain::VerisignGrs < Whois::Domain::Base
2
+ HOST = "whois.verisign-grs.com"
3
+ ATTR_MATCH = /^ ([^:]+):\W*(.*)$/
4
+ responds_to :com, :net, :jobs, :tv
5
+
6
+ def initialize(name)
7
+ @name = name
8
+ @host = nil
9
+
10
+ query
11
+
12
+ # Requery if the whois_server is different from HOST (or whois.iana.org
13
+ # which doesn't appear to return much data). Check that the whois_server
14
+ # does in fact return data before using.
15
+ unless ( whois_server.empty? || [HOST, 'whois.iana.org'].include?(whois_server) )
16
+ @host = whois_server
17
+ old_raw = @raw
18
+ query
19
+ @raw = old_raw if (@raw =~ /not available/)
20
+ end
21
+ end
22
+
23
+ def host
24
+ return @host unless @host.nil?
25
+
26
+ case @name.match(/.*\.([^\.]+)$/)[1]
27
+ when 'jobs' then "jobswhois.verisign-grs.com"
28
+ when 'tv' then "tvwhois.verisign-grs.com"
29
+ else "whois.verisign-grs.com"
30
+ end
31
+ end
32
+
33
+ DATABASE_UPDATED_AT_REGEXES = [
34
+ /Last update of whois database: ([^<]*)/,
35
+ /Record last updated on ([^\.]*)/
36
+ ]
37
+
38
+ def database_updated_at
39
+ DATABASE_UPDATED_AT_REGEXES.each do |regex|
40
+ if (match_data = @raw.match(regex))
41
+ return Time.parse(match_data[1])
42
+ end
43
+ end
44
+
45
+ return nil
46
+ end
47
+
48
+ def available?
49
+ @raw =~ /^No match for/
50
+ end
51
+
52
+ def registrant_id
53
+ found = false
54
+ @raw.each_line do |l|
55
+ if l =~ /^Organisation Contact/
56
+ found = true
57
+ elsif found && l =~ /^ID\.+:\s+(.+)/
58
+ return $1
59
+ end
60
+ end
61
+ ''
62
+ end
63
+ end
@@ -1,30 +1,34 @@
1
- class Whois::Domain::Ws < Whois::Domain::Base
2
- HOST = "whois.website.ws"
3
- ATTR_MATCH = /\s*([^:]+):\s+(.*)$/
4
- responds_to :ws
5
-
6
- ATTR_NAMES = {
7
- :registrar_name => "Registrar Name",
8
- :whois_server => "Registrar Whois",
9
- :created_on => "Domain Created",
10
- :updated_on => "Domain Last Updated",
11
- :expires_on => "Domain Currently Expires"
12
- }
13
-
14
- def available?
15
- @raw =~ /^No match/
16
- end
17
-
18
- def name_servers
19
- found = false
20
- ns_ary = []
21
- @raw.each_line do |l|
22
- if l =~ /Current Nameservers:/
23
- found = true
24
- elsif found && l =~ /^\s*(\S+)/
25
- ns_ary << $1
26
- end
27
- end
28
- ns_ary
29
- end
30
- end
1
+ class Whois::Domain::Ws < Whois::Domain::Base
2
+ HOST = "whois.website.ws"
3
+ ATTR_MATCH = /\s*([^:]+):\s+(.*)$/
4
+ responds_to :ws
5
+
6
+ ATTR_NAMES = {
7
+ :registrar_name => "Registrar Name",
8
+ :whois_server => "Registrar Whois",
9
+ :created_on => "Domain Created",
10
+ :updated_on => "Domain Last Updated",
11
+ :expires_on => "Domain Currently Expires"
12
+ }
13
+
14
+ def available?
15
+ @raw =~ /^No match/
16
+ end
17
+
18
+ def lookup_restricted?
19
+ @raw =~ /You exceeded the maximum allowable number of whois lookups/
20
+ end
21
+
22
+ def name_servers
23
+ found = false
24
+ ns_ary = []
25
+ @raw.each_line do |l|
26
+ if l =~ /Current Nameservers:/
27
+ found = true
28
+ elsif found && l =~ /^\s*(\S+)/
29
+ ns_ary << $1
30
+ end
31
+ end
32
+ ns_ary
33
+ end
34
+ end
data/lib/whois/domain.rb CHANGED
@@ -1,18 +1,18 @@
1
- module Whois::Domain
2
- @@tlds = {}
3
-
4
- def self.tlds
5
- @@tlds
6
- end
7
-
8
- def self.new(domain_name)
9
- tld = domain_name.match(/.*\.([^\.]+)$/)[1].to_sym
10
- class_name = @@tlds.find{|c, tlds_ary| tlds_ary.include?(tld)}[0]
11
- const_get(class_name).new(domain_name)
12
- end
13
- end
14
-
15
- require 'whois/domain/base.rb'
16
- Dir.new(File.dirname(__FILE__) + '/domain').each do |file|
17
- require('whois/domain/' + File.basename(file)) if File.extname(file) == ".rb"
18
- end
1
+ module Whois::Domain
2
+ @@tlds = {}
3
+
4
+ def self.tlds
5
+ @@tlds
6
+ end
7
+
8
+ def self.new(domain_name)
9
+ tld = domain_name.match(/.*\.([^\.]+)$/)[1].to_sym
10
+ class_name = @@tlds.find{|c, tlds_ary| tlds_ary.include?(tld)}[0]
11
+ const_get(class_name).new(domain_name)
12
+ end
13
+ end
14
+
15
+ require 'whois/domain/base.rb'
16
+ Dir.new(File.dirname(__FILE__) + '/domain').each do |file|
17
+ require('whois/domain/' + File.basename(file)) if File.extname(file) == ".rb"
18
+ end
@@ -0,0 +1,3 @@
1
+ module Whois
2
+ VERSION = '0.6.0'.freeze
3
+ end
data/lib/whois.rb CHANGED
@@ -1,9 +1,11 @@
1
- require 'socket'
2
- require 'date'
3
- require 'time'
4
-
5
- module Whois
6
- VERSION = '0.5.0'
7
- end
8
-
9
- require 'whois/domain'
1
+ require 'socket'
2
+ require 'date'
3
+ require 'time'
4
+
5
+ module Whois
6
+ class LookupRestricted < StandardError
7
+ end
8
+ end
9
+
10
+ require 'whois/version'
11
+ require 'whois/domain'
data/test/test_helper.rb CHANGED
File without changes
@@ -1,24 +1,24 @@
1
- require 'test_helper'
2
-
3
- class Whois::Domain::AeroTest < Test::Unit::TestCase
4
-
5
- def test_whois
6
- assert_whois_data(EXP_DATA)
7
- assert Whois::Domain.new("not-reg-1234.aero").available?
8
- end
9
-
10
- EXP_DATA = {
11
- :name => "information.aero",
12
- :kind => "Aero",
13
- :created_on => "2002-02-19",
14
- :updated_on => "2009-02-20",
15
- :expires_on => "2010-02-19",
16
- :database_updated_at => false,
17
- :registrar_name => "SITA (9999)",
18
- :whois_server => "whois.aero",
19
- :raw_match => "Domain Name:INFORMATION.AERO",
20
- :status => ['OK'],
21
- :name_servers => ['NS01.AFILIAS.INFO', 'NS02.AFILIAS.INFO']
22
- }
23
-
24
- end
1
+ require 'test_helper'
2
+
3
+ class Whois::Domain::AeroTest < Test::Unit::TestCase
4
+
5
+ def test_whois
6
+ assert_whois_data(EXP_DATA)
7
+ assert Whois::Domain.new("not-reg-1234.aero").available?
8
+ end
9
+
10
+ EXP_DATA = {
11
+ :name => 'information.aero',
12
+ :kind => 'Aero',
13
+ :created_on => '2002-02-19',
14
+ :updated_on => '2010-02-20',
15
+ :expires_on => '2011-02-19',
16
+ :database_updated_at => false,
17
+ :registrar_name => "SITA (9999)",
18
+ :whois_server => "whois.aero",
19
+ :raw_match => "Domain Name:INFORMATION.AERO",
20
+ :status => ['OK'],
21
+ :name_servers => ['NS01.AFILIAS.INFO', 'NS02.AFILIAS.INFO']
22
+ }
23
+
24
+ end
@@ -1,24 +1,24 @@
1
- require 'test_helper'
2
-
3
- class Whois::Domain::AfiliasTest < Test::Unit::TestCase
4
-
5
- def test_whois
6
- assert_whois_data(EXP_DATA)
7
- assert Whois::Domain.new("not-reg-1234.info").available?
8
- end
9
-
10
- EXP_DATA = {
11
- :name => "nic.info",
12
- :kind => "Afilias",
13
- :created_on => "2001-07-27",
14
- :updated_on => "2002-06-10",
15
- :expires_on => "2011-07-27",
16
- :database_updated_at => false,
17
- :registrar_name => "Afilias Ltd. (R145-LRMS)",
18
- :whois_server => "whois.afilias.net",
19
- :raw_match => "Domain Name:NIC.INFO",
20
- :status => ['DELETE PROHIBITED', 'RENEW PROHIBITED', 'TRANSFER PROHIBITED', 'UPDATE PROHIBITED'],
21
- :name_servers => ['NS01.AFILIAS.INFO', 'NS02.AFILIAS.INFO']
22
- }
23
-
24
- end
1
+ require 'test_helper'
2
+
3
+ class Whois::Domain::AfiliasTest < Test::Unit::TestCase
4
+
5
+ def test_whois
6
+ assert_whois_data(EXP_DATA)
7
+ assert Whois::Domain.new("not-reg-1234.info").available?
8
+ end
9
+
10
+ EXP_DATA = {
11
+ :name => "nic.info",
12
+ :kind => "Afilias",
13
+ :created_on => "2001-07-27",
14
+ :updated_on => "2002-06-10",
15
+ :expires_on => "2011-07-27",
16
+ :database_updated_at => false,
17
+ :registrar_name => "Afilias Ltd. (R145-LRMS)",
18
+ :whois_server => "whois.afilias.net",
19
+ :raw_match => "Domain Name:NIC.INFO",
20
+ :status => ['DELETE PROHIBITED', 'RENEW PROHIBITED', 'TRANSFER PROHIBITED', 'UPDATE PROHIBITED'],
21
+ :name_servers => ['NS01.AFILIAS.INFO', 'NS02.AFILIAS.INFO']
22
+ }
23
+
24
+ end
@@ -1,28 +1,28 @@
1
- require 'test_helper'
2
-
3
- class Whois::Domain::CatTest < Test::Unit::TestCase
4
-
5
- def test_whois
6
- assert_whois_data(EXP_DATA)
7
- assert Whois::Domain.new("not-reg-1234.cat").available?
8
- end
9
-
10
- def test_register_url
11
- assert_equal "http://domini.cat/en_registrar.html", Whois::Domain.new("domini.cat").register_url
12
- end
13
-
14
- EXP_DATA = {
15
- :name => "domini.cat",
16
- :kind => "Cat",
17
- :created_on => "2006-05-05",
18
- :updated_on => "2009-06-19",
19
- :expires_on => "2010-05-05",
20
- :database_updated_at => false,
21
- :registrar_name => "R-906 (puntCAT Administrative Account)",
22
- :whois_server => "whois.cat",
23
- :raw_match => "Domain Name: domini.cat",
24
- :status => ['ok'],
25
- :name_servers => nil # I can't figure out a stable test. The order changes and they may have some weird space-like character at the end.
26
- }
27
-
28
- end
1
+ require 'test_helper'
2
+
3
+ class Whois::Domain::CatTest < Test::Unit::TestCase
4
+
5
+ def test_whois
6
+ assert_whois_data(EXP_DATA)
7
+ assert Whois::Domain.new("not-reg-1234.cat").available?
8
+ end
9
+
10
+ def test_register_url
11
+ assert_equal "http://domini.cat/en_registrar.html", Whois::Domain.new("domini.cat").register_url
12
+ end
13
+
14
+ EXP_DATA = {
15
+ :name => 'domini.cat',
16
+ :kind => 'Cat',
17
+ :created_on => '2006-05-05',
18
+ :updated_on => '2010-06-19',
19
+ :expires_on => '2011-05-05',
20
+ :database_updated_at => false,
21
+ :registrar_name => "R-906 (puntCAT Administrative Account)",
22
+ :whois_server => "whois.cat",
23
+ :raw_match => "Domain Name: domini.cat",
24
+ :status => ['ok'],
25
+ :name_servers => nil # I can't figure out a stable test. The order changes and they may have some weird space-like character at the end.
26
+ }
27
+
28
+ end
@@ -1,28 +1,28 @@
1
- require 'test_helper'
2
-
3
- class Whois::Domain::CoopTest < Test::Unit::TestCase
4
-
5
- def test_coop
6
- assert_whois_data(EXP_COOP)
7
- assert Whois::Domain.new("not-reg-0987.coop").available?
8
- end
9
-
10
- def test_register_url
11
- assert_equal "http://domains.coop/", Whois::Domain.new("domains.coop").register_url
12
- end
13
-
14
- EXP_COOP = {
15
- :name => "domains.coop",
16
- :kind => "Coop",
17
- :created_on => "2002-07-09",
18
- :updated_on => "2007-01-17",
19
- :expires_on => "2011-07-09",
20
- :database_updated_at => false,
21
- :registrar_name => "domains.coop",
22
- :whois_server => "whois.nic.coop",
23
- :raw_match => "Domain Name: domains.coop",
24
- :status => ['ok'],
25
- :name_servers => ['ns2.mydyndns.org', 'ns3.mydyndns.org', 'ns4.mydyndns.org', 'ns5.mydyndns.org', 'ns1.mydyndns.org']
26
- }
27
-
28
- end
1
+ require 'test_helper'
2
+
3
+ class Whois::Domain::CoopTest < Test::Unit::TestCase
4
+
5
+ def test_coop
6
+ assert_whois_data(EXP_COOP)
7
+ assert Whois::Domain.new("not-reg-0987.coop").available?
8
+ end
9
+
10
+ def test_register_url
11
+ assert_equal "http://domains.coop/", Whois::Domain.new("domains.coop").register_url
12
+ end
13
+
14
+ EXP_COOP = {
15
+ :name => "domains.coop",
16
+ :kind => "Coop",
17
+ :created_on => "2002-07-09",
18
+ :updated_on => "2007-01-17",
19
+ :expires_on => "2011-07-09",
20
+ :database_updated_at => false,
21
+ :registrar_name => "domains.coop",
22
+ :whois_server => "whois.nic.coop",
23
+ :raw_match => "Domain Name: domains.coop",
24
+ :status => ['ok'],
25
+ :name_servers => ['ns2.mydyndns.org', 'ns3.mydyndns.org', 'ns4.mydyndns.org', 'ns5.mydyndns.org', 'ns1.mydyndns.org']
26
+ }
27
+
28
+ end
@@ -1,24 +1,24 @@
1
- require 'test_helper'
2
-
3
- class Whois::Domain::EducauseTest < Test::Unit::TestCase
4
-
5
- def test_whois
6
- assert_whois_data(EXP_DATA)
7
- assert Whois::Domain.new("not-reg-1234.edu").available?
8
- end
9
-
10
- EXP_DATA = {
11
- :name => "educause.edu",
12
- :kind => "Educause",
13
- :created_on => "1998-03-11",
14
- :updated_on => "2009-08-01",
15
- :expires_on => "2010-07-31",
16
- :database_updated_at => false,
17
- :registrar_name => "Educause",
18
- :whois_server => "whois.educause.edu",
19
- :raw_match => "Domain Name: EDUCAUSE.EDU",
20
- :status => [],
21
- :name_servers => ['NS3.EDUCAUSE.EDU', 'NS4.EDUCAUSE.EDU', 'NS5.EDUCAUSE.EDU']
22
- }
23
-
24
- end
1
+ require 'test_helper'
2
+
3
+ class Whois::Domain::EducauseTest < Test::Unit::TestCase
4
+
5
+ def test_whois
6
+ assert_whois_data(EXP_DATA)
7
+ assert Whois::Domain.new('not-reg-1234.edu').available?
8
+ end
9
+
10
+ EXP_DATA = {
11
+ :name => 'educause.edu',
12
+ :kind => 'Educause',
13
+ :created_on => '1998-03-11',
14
+ :updated_on => '2010-08-04',
15
+ :expires_on => '2010-07-31',
16
+ :database_updated_at => false,
17
+ :registrar_name => 'Educause',
18
+ :whois_server => 'whois.educause.edu',
19
+ :raw_match => 'Domain Name: EDUCAUSE.EDU',
20
+ :status => [],
21
+ :name_servers => ['NS3.EDUCAUSE.EDU','NS01.ENG01.DATA393.NET', 'NS5.EDUCAUSE.EDU', 'NS02.ENG01.DATA393.NET']
22
+ }
23
+
24
+ end
@@ -1,28 +1,28 @@
1
- require 'test_helper'
2
-
3
- class Whois::Domain::GovTest < Test::Unit::TestCase
4
-
5
- def test_whois
6
- assert_whois_data(EXP_DATA)
7
- assert Whois::Domain.new("not-reg-1234.gov").available?
8
- end
9
-
10
- def test_register_url
11
- assert_equal "http://www.dotgov.gov/help_how.aspx", Whois::Domain.new("not-reg-1234.gov").register_url
12
- end
13
-
14
- EXP_DATA = {
15
- :name => "dotgov.gov",
16
- :kind => "Gov",
17
- :created_on => nil,
18
- :updated_on => nil,
19
- :expires_on => nil,
20
- :database_updated_at => false,
21
- :registrar_name => nil,
22
- :whois_server => "whois.nic.gov",
23
- :raw_match => "Domain Name: dotgov.gov",
24
- :status => ['Active'],
25
- :name_servers => []
26
- }
27
-
28
- end
1
+ require 'test_helper'
2
+
3
+ class Whois::Domain::GovTest < Test::Unit::TestCase
4
+
5
+ def test_whois
6
+ assert_whois_data(EXP_DATA)
7
+ assert Whois::Domain.new("not-reg-1234.gov").available?
8
+ end
9
+
10
+ def test_register_url
11
+ assert_equal "http://www.dotgov.gov/help_how.aspx", Whois::Domain.new("not-reg-1234.gov").register_url
12
+ end
13
+
14
+ EXP_DATA = {
15
+ :name => "dotgov.gov",
16
+ :kind => "Gov",
17
+ :created_on => nil,
18
+ :updated_on => nil,
19
+ :expires_on => nil,
20
+ :database_updated_at => false,
21
+ :registrar_name => nil,
22
+ :whois_server => "whois.nic.gov",
23
+ :raw_match => "Domain Name: dotgov.gov",
24
+ :status => ['Active'],
25
+ :name_servers => []
26
+ }
27
+
28
+ end