dl_validator 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/config/{config.rb → dl_config.rb} +1 -1
- data/lib/dl_validator.rb +4 -4
- data/lib/dl_validator/version.rb +1 -1
- data/test/test_dl_validator.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b00ae3875765353b1516e9b3a1a4bab19fd97d5
|
4
|
+
data.tar.gz: a8d90bf06f6ed87cc24263cf2e0422d4c3748b2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5ac7ede864602cc52cb0e93d464fb52ebdaef4233e51ff6dce5feddb2dd9186af0f4300dd31abb3c8cb9531e14d5dc4d58e4ebdd6c884d8ae90106de91a0605
|
7
|
+
data.tar.gz: a4108d0785bd3939511d81529d050cc71a4eda13f58aba8f1f7d73c9d1e664521587bfcb13cfd8de2a37ce6aec1d74ffba61367ae595bbff39deffc1caa502ef
|
data/lib/dl_validator.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'dl_validator/version'
|
2
|
-
require 'config/
|
2
|
+
require 'config/dl_config'
|
3
3
|
require 'extensions/drivers_license_invalid_validator' if defined?(Rails)
|
4
4
|
|
5
5
|
module DlValidator
|
@@ -12,13 +12,13 @@ module DlValidator
|
|
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
|
15
|
-
return true if !
|
15
|
+
return true if !DlConfig::STATES.include?(dl_state) and !DlConfig::STATES.values.include?(dl_state)
|
16
16
|
|
17
17
|
# Find the state abbreviation key we need to access our regex hash.
|
18
18
|
key = get_abbreviation_key(dl_state)
|
19
19
|
|
20
20
|
# Regular expression match to validate the drivers license is invalid or not
|
21
|
-
return false if
|
21
|
+
return false if DlConfig::STATES_REGEX[key].match(dl_number)
|
22
22
|
true
|
23
23
|
end
|
24
24
|
|
@@ -27,7 +27,7 @@ module DlValidator
|
|
27
27
|
# If the dl_state is greater than 2 then it is a full state name and we need to find the corresponding abbreviation for that state.
|
28
28
|
key = ''
|
29
29
|
if dl_state.length > 2
|
30
|
-
|
30
|
+
DlConfig::STATES.each do |k, v|
|
31
31
|
key = k if v == dl_state
|
32
32
|
end
|
33
33
|
else
|
data/lib/dl_validator/version.rb
CHANGED
data/test/test_dl_validator.rb
CHANGED
@@ -55,11 +55,11 @@ class DlValidatorTest < Test::Unit::TestCase
|
|
55
55
|
end
|
56
56
|
|
57
57
|
context '#get_abbreviation_key' do
|
58
|
-
DlValidator::
|
58
|
+
DlValidator::DlConfig::STATES.each do |state_abbreviation, state_name|
|
59
59
|
should "return the correct state abbreviation #{state_abbreviation}" do
|
60
60
|
assert_equal state_abbreviation, DlValidator.get_abbreviation_key(state_name)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
65
|
-
end
|
65
|
+
end
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Medeiros
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -68,7 +68,7 @@ files:
|
|
68
68
|
- README.md
|
69
69
|
- Rakefile
|
70
70
|
- dl_validator.gemspec
|
71
|
-
- lib/config/
|
71
|
+
- lib/config/dl_config.rb
|
72
72
|
- lib/dl_validator.rb
|
73
73
|
- lib/dl_validator/version.rb
|
74
74
|
- lib/extensions/drivers_license_invalid_validator.rb
|