Sha256: 7e99c4aca82391919e915c2b862f97dcf561a0aa23816f45d001579835d9ddc0

Contents?: true

Size: 575 Bytes

Versions: 4

Compression:

Stored size: 575 Bytes

Contents

require 'spec_helper'

describe Valvat::Checksum::ES do
  %w(ESA13585625 ESB83871236 ESE54507058 ES25139013J ESQ1518001A ESQ5018001G ESX4942978W ESX7676464F ESB10317980).each do |valid_vat|
    it "returns true on valid vat #{valid_vat}" do
      expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
    end

    invalid_vat = "#{valid_vat[0..-6]}#{valid_vat[-2]}#{valid_vat[-5]}#{valid_vat[-4]}#{valid_vat[-3]}#{valid_vat[-1]}"

    it "returns false on invalid vat #{invalid_vat}" do
      expect(Valvat::Checksum.validate(invalid_vat)).to eql(false)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
valvat-0.6.8 spec/valvat/checksum/es_spec.rb
valvat-0.6.7 spec/valvat/checksum/es_spec.rb
valvat-0.6.6 spec/valvat/checksum/es_spec.rb
valvat-0.6.5 spec/valvat/checksum/es_spec.rb