Sha256: a67150cca589ccad7dd002ce802639ccd93c986ddae3d2de2606dc26a8b59138

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

require 'spec_helper'

describe Valvat::Checksum::PL do
  %w(PL8567346215 PL5260211587 PL9720575348 PL5272650022).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..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-3]}"

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

  it "returns false on special case invalid VAT PL8566445330" do
    expect(Valvat::Checksum.validate("PL8566445330")).to eql(false)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
valvat-1.0.1 spec/valvat/checksum/pl_spec.rb
valvat-1.0.0 spec/valvat/checksum/pl_spec.rb