Sha256: a22b548a259d6fba43e6de3552dc08d8fce8274e98aba6e9880be4beb17ee7e7

Contents?: true

Size: 634 Bytes

Versions: 5

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Valvat::Checksum::ES do
  %w[ESA13585625 ESB83871236 ESE54507058 ES25139013J ESQ1518001A ESQ5018001G ESX4942978W ESX7676464F ESB10317980
     ESY3860557K ESY2207765D].each do |valid_vat|
    it "returns true on valid VAT #{valid_vat}" do
      expect(Valvat::Checksum.validate(valid_vat)).to be(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 be(false)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
valvat-1.1.4 spec/valvat/checksum/es_spec.rb
valvat-1.1.3 spec/valvat/checksum/es_spec.rb
valvat-1.1.2 spec/valvat/checksum/es_spec.rb
valvat-1.1.1 spec/valvat/checksum/es_spec.rb
valvat-1.1.0 spec/valvat/checksum/es_spec.rb