Skip to content

Commit

Permalink
adds J as a valid starting letter for NIFs - see more here http://www…
Browse files Browse the repository at this point in the history
  • Loading branch information
dgilperez committed Apr 22, 2017
1 parent 9b38a7b commit 0aaedb2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/spanish_vat_validators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def validate_cif(v)
odd = 0
uletter = ["J", "A", "B", "C", "D", "E", "F", "G", "H", "I"]
text = value.upcase
regular = /^[ABCDEFGHKLMNPQRSVW]\d{7}[0-9,A-J]$/#g);
regular = /^[ABCDEFGHJKLMNPQRSVW]\d{7}[0-9,A-J]$/#g);
if regular.match(value).blank?
false
else
Expand Down
2 changes: 1 addition & 1 deletion spec/spanish_vat_validators_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
describe ActiveModel::Validations::ValidCifValidator do
describe '#validate_each' do
it 'does not add errors with a valid number' do
%w[S6185663I C2871341J G37880135 F43766880 J27950005 V63423321].each do |identification_number|
%w[S6185663I C2871341J G37880135 F43766880 A58818501 J27950005 V63423321].each do |identification_number|
record = build_record(identification_number)
should_be_valid(record)
end
Expand Down

0 comments on commit 0aaedb2

Please sign in to comment.