domain_name_validator 0.4 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ class DomainNameValidator
|
|
7
7
|
MAX_DOMAIN_LENGTH = 253
|
8
8
|
MAX_LABEL_LENGTH = 63
|
9
9
|
MAX_LEVELS = 127
|
10
|
-
MAX_TLD_LENGTH = 3
|
10
|
+
MAX_TLD_LENGTH = 3 # Except for "aero", "arpa", "info" and "museum"
|
11
11
|
MIN_LEVELS = 2
|
12
12
|
MIN_TLD_LENGTH = 2
|
13
13
|
|
@@ -62,6 +62,7 @@ class DomainNameValidator
|
|
62
62
|
if parts.last.size < MIN_TLD_LENGTH || parts.last.size > MAX_TLD_LENGTH
|
63
63
|
unless parts.last == 'arpa' ||
|
64
64
|
parts.last == 'aero' ||
|
65
|
+
parts.last == 'info' ||
|
65
66
|
parts.last == 'museum' ||
|
66
67
|
parts.last.match(/^xn--/)
|
67
68
|
errs << ERRS[:bogus_tld]
|
@@ -85,6 +85,12 @@ describe DomainNameValidator do
|
|
85
85
|
response.should be == true
|
86
86
|
end
|
87
87
|
|
88
|
+
it "should succeed if the TLD is too long but equals 'info'" do
|
89
|
+
domain = "test.info"
|
90
|
+
response = @validator.validate(domain)
|
91
|
+
response.should be == true
|
92
|
+
end
|
93
|
+
|
88
94
|
it "should succeed if the TLD is too long but equals 'arpa'" do
|
89
95
|
domain = "test.arpa"
|
90
96
|
response = @validator.validate(domain)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domain_name_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-07-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &27415812 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *27415812
|
25
25
|
description: Checks the validity of domain names.
|
26
26
|
email:
|
27
27
|
- dkeener@keenertech.com
|