dl_validator 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/config/dl_config.rb +1 -1
- data/lib/dl_validator.rb +2 -2
- data/lib/dl_validator/version.rb +1 -1
- data/test/test_dl_validator.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 476c7cbd7aedf3ebe488aef034578ee81b577c5e
|
4
|
+
data.tar.gz: 63c363c222cd7547748a0f4151930f5346bfc0c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ae0f21fa6ee9cd499cf1a74d749027a89cd73be649020f14bec9fc1525030e6d147da53d5c46a091ecc239d0ff8633c852c94b055150431d97c626833683bed
|
7
|
+
data.tar.gz: 5ced51291a23f0c9b30add49620cf54cb5b77d73a97178c40056a2521c13c45ebcc7264958107e3b6747a17021a1d99799cfc4cd6c00633b0286a27c0a7fb34d
|
data/Gemfile.lock
CHANGED
data/lib/config/dl_config.rb
CHANGED
@@ -75,7 +75,7 @@ module DlValidator
|
|
75
75
|
'IN' => /(^[A-Z]{1}[0-9]{9}$)|(^[0-9]{9,10}$)/, # Format: 1Alpha+9Numeric or 9Numeric or 10Numeric
|
76
76
|
'IA' => /(^[0-9]{9}$)|(^[0-9]{3}[A-Z]{2}[0-9]{4})$/, # Format: 9Numeric or 3Numeric+2Alpha+4Numeric
|
77
77
|
'KS' => /(^([A-Z]{1}[0-9]{1}){2}[A-Z]{1}$)|(^[A-Z]{1}[0-9]{8}$)|(^[0-9]{9}$)/, # Format: 1Alpha+1Numeric+1Alpha+1Numeric+1Alpha or 1Alpha+8Numeric or 9Numeric
|
78
|
-
'KY' => /(^[
|
78
|
+
'KY' => /(^[A-Z]{1}[0-9]{8,9}$)|(^[0-9]{9}$)/, # Format: 1Alpha+8Numeric or 1Alpha+9Numeric or 9Numeric
|
79
79
|
'LA' => /^[0-9]{1,9}$/, # Format: 1-9Numeric
|
80
80
|
'ME' => /(^[0-9]{7,8}$)|(^[0-9]{7}[A-Z]{1}$)/, # Format: 7Numeric or 7Numeric+1Alpha or 8Numeric
|
81
81
|
'MD' => /^[A-Z]{1}[0-9]{12}$/, # Format: 1Alpha+12Numeric
|
data/lib/dl_validator.rb
CHANGED
@@ -7,8 +7,8 @@ module DlValidator
|
|
7
7
|
# Stop and return true if either dl_number or dl_state are nil
|
8
8
|
return true if dl_number.nil? or dl_state.nil?
|
9
9
|
|
10
|
-
# Downcase and remove non-word characters
|
11
|
-
dl_number = dl_number.to_s.upcase.gsub(/
|
10
|
+
# Downcase and remove non-word characters that are not asterisks
|
11
|
+
dl_number = dl_number.to_s.upcase.gsub(/[^a-zA-Z0-9\*]*/, '')
|
12
12
|
dl_state = dl_state.to_s.upcase.gsub(/(\W|\d|_)*/, '')
|
13
13
|
|
14
14
|
# Stop here and return true if the state does not exist
|
data/lib/dl_validator/version.rb
CHANGED
data/test/test_dl_validator.rb
CHANGED
@@ -45,6 +45,16 @@ class DlValidatorTest < Test::Unit::TestCase
|
|
45
45
|
assert !DlValidator.invalid?(license, 'FL')
|
46
46
|
end
|
47
47
|
|
48
|
+
should 'handle the state of Washington with an (*) in the License and should be valid' do
|
49
|
+
license = 'DEOLID*237NS'
|
50
|
+
assert DlValidator.valid?(license, 'WA')
|
51
|
+
end
|
52
|
+
|
53
|
+
should 'handle the state of Washington with an (*) in the License and should be invalid' do
|
54
|
+
license = 'DEOLID*23dsdf7NS'
|
55
|
+
assert !DlValidator.valid?(license, 'WA')
|
56
|
+
end
|
57
|
+
|
48
58
|
should 'return true for a nil drivers_license_number' do
|
49
59
|
assert DlValidator.invalid?(drivers_license_number=nil, 'FL')
|
50
60
|
end
|
@@ -52,6 +62,17 @@ class DlValidatorTest < Test::Unit::TestCase
|
|
52
62
|
should 'return true for a nil drivers_license_state' do
|
53
63
|
assert DlValidator.invalid?('123456', drivers_license_state=nil)
|
54
64
|
end
|
65
|
+
|
66
|
+
should 'return valid for Kentucky' do
|
67
|
+
license = 'k12345678'
|
68
|
+
assert DlValidator.valid?(license, 'KY')
|
69
|
+
end
|
70
|
+
|
71
|
+
should 'return invalid for Kentucky' do
|
72
|
+
license = 'ka12345678'
|
73
|
+
assert !DlValidator.valid?(license, 'KY')
|
74
|
+
end
|
75
|
+
|
55
76
|
end
|
56
77
|
|
57
78
|
context '.get_abbreviation_key' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dl_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Medeiros
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|