Sha256: 71249328dac29ba02a6a0e138f59bc1a3a159c31f56af60771aaa1dfae312987

Contents?: true

Size: 515 Bytes

Versions: 4

Compression:

Stored size: 515 Bytes

Contents

require 'spec_helper'

describe Valvat::Checksum::PT do
  %w(PT136695973 PT501413197 PT503037753 PT500243590 PT500100144 PT502921838).each do |valid_vat|
    it "returns true on valid vat #{valid_vat}" do
      Valvat::Checksum.validate(valid_vat).should eql(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
      Valvat::Checksum.validate(invalid_vat).should eql(false)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
valvat-0.6.2 spec/valvat/checksum/pt_spec.rb
valvat-0.6.1 spec/valvat/checksum/pt_spec.rb
valvat-0.6.0 spec/valvat/checksum/pt_spec.rb
valvat-0.5.0 spec/valvat/checksum/pt_spec.rb