Skip to content

Commit

Permalink
Merge pull request #5 from jonsgreene/master
Browse files Browse the repository at this point in the history
Corrected regex for Kentucky
  • Loading branch information
amedeiros authored Sep 25, 2016
2 parents 3410c6f + d32cebe commit 59bc6a4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/config/dl_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class DlConfig
'IN' => /(^[A-Z]{1}[0-9]{9}$)|(^[0-9]{9,10}$)/, # Format: 1Alpha+9Numeric or 9Numeric or 10Numeric
'IA' => /(^[0-9]{9}$)|(^[0-9]{3}[A-Z]{2}[0-9]{4})$/, # Format: 9Numeric or 3Numeric+2Alpha+4Numeric
'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
'KY' => /(^[A_Z]{1}[0-9]{8,9}$)|(^[0-9]{9}$)/, # Format: 1Alpha+8Numeric or 1Alpha+9Numeric or 9Numeric
'KY' => /(^[A-Z]{1}[0-9]{8,9}$)|(^[0-9]{9}$)/, # Format: 1Alpha+8Numeric or 1Alpha+9Numeric or 9Numeric
'LA' => /^[0-9]{1,9}$/, # Format: 1-9Numeric
'ME' => /(^[0-9]{7,8}$)|(^[0-9]{7}[A-Z]{1}$)/, # Format: 7Numeric or 7Numeric+1Alpha or 8Numeric
'MD' => /^[A-Z]{1}[0-9]{12}$/, # Format: 1Alpha+12Numeric
Expand Down
2 changes: 1 addition & 1 deletion lib/dl_validator/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module DlValidator
VERSION = '0.0.6'
VERSION = '0.0.7'
end
11 changes: 11 additions & 0 deletions test/test_dl_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ class DlValidatorTest < Test::Unit::TestCase
should 'return true for a nil drivers_license_state' do
assert DlValidator.invalid?('123456', drivers_license_state=nil)
end

should 'return valid for Kentucky' do
license = 'k12345678'
assert DlValidator.valid?(license, 'KY')
end

should 'return invalid for Kentucky' do
license = 'ka12345678'
assert !DlValidator.valid?(license, 'KY')
end

end

context '.get_abbreviation_key' do
Expand Down

0 comments on commit 59bc6a4

Please sign in to comment.