za-id-validator 0.1.0 → 0.1.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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -1,7 +1,7 @@
1
1
  module ZaIdValidator
2
2
 
3
- def validate_za_identity_number?(id)
4
- length_is_valid?
3
+ def valid_za_identity_number?(id)
4
+ length_is_valid?(id) && id.to_s.chars.to_a.last.to_i == z(id)
5
5
  end
6
6
 
7
7
  def length_is_valid?(id)
@@ -37,6 +37,22 @@ class TestZaIdValidator < Test::Unit::TestCase
37
37
  assert_equal 7, z(@valid)
38
38
  end
39
39
 
40
+ should "be a valid ID number" do
41
+ assert valid_za_identity_number?(@valid)
42
+ end
43
+
44
+ end
45
+
46
+ context "an invalid ID number" do
47
+
48
+ setup do
49
+ @invalid = "8001015009086"
50
+ end
51
+
52
+ should "not be a valid ID number" do
53
+ assert !valid_za_identity_number?(@invalid)
54
+ end
55
+
40
56
  end
41
57
 
42
58
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{za-id-validator}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Craig Paterson"]
12
- s.date = %q{2012-02-14}
12
+ s.date = %q{2012-02-15}
13
13
  s.description = %q{Validates South African identity numbers}
14
14
  s.email = %q{darksavant@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: za-id-validator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Craig Paterson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-14 00:00:00 +02:00
18
+ date: 2012-02-15 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency