identificamex 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4635e390048785c33082dd5a59d948e44c313130
4
- data.tar.gz: 708be8ef993125a8e73a00fc7c4d642d8f0550f7
3
+ metadata.gz: 2dc9afc50978c27d8bad83770096487d59bf1688
4
+ data.tar.gz: 848e787efaccb287c73a7ba91ca2f8920bf296c7
5
5
  SHA512:
6
- metadata.gz: bf93e16569ecc8cbf783dae290cecd170229fb4eafb9d5be42c7b046a7ae1ae40fb7e04894351e11e7dcb5b7ca557f575554a51054d8a8dc3040471643a9e5cc
7
- data.tar.gz: b208aa3fe2a00a452d1d4a628b9c7e4c0839426b4dd7c71b396567af9eb78c583c931e2cf4b51701e11b10320e0d9a2054d9a92464a0a330ae58fa31056770ec
6
+ metadata.gz: 06b821b59c62f72677e9ee0157815726b3da00f7a41dd045d5bb88d4fbecdb478d2aecbc8db646bebafb617a6898c12b1f0e329c986edfd0a8f8150e470afb0e
7
+ data.tar.gz: 30776ce47ddcc453a07c8a168ff51360af8e0891b611bfbe18621b46d33714c8cbddcac134df438f1e5100870e93a28ab4a7ba81fb343f1a5969e06193cffaf5
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.5
1
+ 2.4.0
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  class CurpFormatValidator < ActiveModel::EachValidator
3
3
  def validate_each(object, attribute, value)
4
- unless value =~ /\A[A-Z][AEIOUX][A-Z]{2}[0-9]{2}[0-1][0-9][0-3][0-9][MH][A-Z][A-Z][BCDFGHJKLMNÑPQRSTVWXYZ]{3}[0-9A-Z][0-9]\z/i
4
+ unless value =~ /\A[A-Z][AEIOUX][A-Z]{2}[0-9]{2}[0-1][0-9][0-3][0-9][MH]([A-Z][BCDFGHJKLMNÑPQRSTVWXYZ]|NE)[BCDFGHJKLMNÑPQRSTVWXYZ]{3}[0-9A-Z][0-9]\z/i
5
5
  object.errors[attribute] << (options[:message] || "no es una CURP válida")
6
6
  end
7
7
  end
@@ -5,6 +5,7 @@ module Identificamex
5
5
 
6
6
  def initialize(rfc_base)
7
7
  @rfc_base = rfc_base
8
+ @tabla_conversiones = nil
8
9
  end
9
10
 
10
11
  def siglas
@@ -1,3 +1,3 @@
1
1
  module Identificamex
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -27,6 +27,10 @@ describe 'curp validator' do
27
27
  it 'accepts generic curp (for woman)' do
28
28
  model(curp: 'XEXX010101HNEXXXA4').must_be :valid?
29
29
  end
30
+
31
+ it 'accepts curp for foreing nationatily' do
32
+ model(curp: 'AAAA111111HNEBBB01').must_be :valid?
33
+ end
30
34
  end # with valid data
31
35
 
32
36
  describe 'with invalid data' do
@@ -67,6 +71,10 @@ describe 'curp validator' do
67
71
  it 'refuses curp (digito verificador alfanumérico)' do
68
72
  model(curp: 'AAAA111111HDFBBB0A').wont_be :valid?
69
73
  end
74
+
75
+ it 'refuses curp with invalid state code' do
76
+ model(curp: 'AAAA111111HFEBBB01').wont_be :valid?
77
+ end
70
78
  end # with invalid data
71
79
 
72
80
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: identificamex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Azarel Doroteo Pacheco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-07 00:00:00.000000000 Z
11
+ date: 2017-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubyforge_project:
115
- rubygems_version: 2.4.5
115
+ rubygems_version: 2.6.10
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Validadores sencillos para los formatos de la Clave Única de Registro de