Sha256: 2ca22436c3a52a4af68cde7b606a04e7c4af7ea452c6e802bab0bad4b477eff2
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
require 'spec_helper' describe Valvat::Checksum::PT do subject { Valvat::Checksum } %w(PT136695973 PT501413197 PT503037753 PT500243590 PT500100144 PT502921838).each do |valid_vat| it "returns true on valid vat #{valid_vat}" do subject.validate(valid_vat).should be_true end invalid_vat = "#{valid_vat[0..-5]}#{valid_vat[-1]}#{valid_vat[-4]}#{valid_vat[-2]}#{valid_vat[-3]}" it "returns false on invalid vat #{invalid_vat}" do subject.validate(invalid_vat).should be_false end end # Portuguese business VAT should start with the following numbers # 1 or 2 (pessoa singular) - singular person # 5 (pessoa colectiva) - collective person # 6 (pessoa colectiva pública) - public collective person # 8 (empresário em nome individual) - individual enterpreneur # 9 (pessoa colectiva irregular ou número provisório) - provisional number # http://www.nif.pt/nif-das-empresas/ %w(PT148166644 PT111623448 PT204874866 PT292261314 PT579104222 PT628910002 PT812627318 PT943935784).each do |number| it "returns true on a valid number - #{number}" do subject.validate(number).should be_true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
valvat-0.6.4 | spec/valvat/checksum/pt_spec.rb |
valvat-0.6.3 | spec/valvat/checksum/pt_spec.rb |