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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edd9dc0c2c26ae559d91785d783d3f9fd59e03be
4
- data.tar.gz: 1384c7c2873506970c933e8d520de03c89a1109a
3
+ metadata.gz: 476c7cbd7aedf3ebe488aef034578ee81b577c5e
4
+ data.tar.gz: 63c363c222cd7547748a0f4151930f5346bfc0c0
5
5
  SHA512:
6
- metadata.gz: a25a11f5075e652e12dfd99ed97d530e6275794ee68d4f5a3e3f135dea42da3cfd80f32db30549d917ea9857649a05241bf6793d0822ae06f6d29aae92ff9b8b
7
- data.tar.gz: dfc04e4322883a83c52fc66e36637bb18f8fb845ff6d4079d2c288f6c2745398c9114bf2d19013710476f7ac5bdc492200b69016bce6d1ac7839c12c32c38ac3
6
+ metadata.gz: 3ae0f21fa6ee9cd499cf1a74d749027a89cd73be649020f14bec9fc1525030e6d147da53d5c46a091ecc239d0ff8633c852c94b055150431d97c626833683bed
7
+ data.tar.gz: 5ced51291a23f0c9b30add49620cf54cb5b77d73a97178c40056a2521c13c45ebcc7264958107e3b6747a17021a1d99799cfc4cd6c00633b0286a27c0a7fb34d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dl_validator (0.0.6)
4
+ dl_validator (0.0.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -41,4 +41,4 @@ DEPENDENCIES
41
41
  test-unit
42
42
 
43
43
  BUNDLED WITH
44
- 1.12.1
44
+ 1.13.3
@@ -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' => /(^[A_Z]{1}[0-9]{8,9}$)|(^[0-9]{9}$)/, # Format: 1Alpha+8Numeric or 1Alpha+9Numeric or 9Numeric
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
@@ -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(/(\W|_)*/, '')
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
@@ -1,3 +1,3 @@
1
1
  module DlValidator
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
@@ -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.6
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-05-03 00:00:00.000000000 Z
11
+ date: 2016-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler