Sha256: 04aaea663fd80941f90fbb8da082db7c13a0348731f86246acc65713f65ed666

Contents?: true

Size: 749 Bytes

Versions: 3

Compression:

Stored size: 749 Bytes

Contents

require 'spec_helper'

describe Valvat::Checksum::SI do
  %w(SI59082437 SI51049406 SI86154575 SI47431857 SI22511822 SI26833921).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..-2]}#{valid_vat[-1].to_i+1}"

    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 SI11111107" do
    expect(Valvat::Checksum.validate("SI11111107")).to eql(false)
  end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
valvat-0.9.1 spec/valvat/checksum/si_spec.rb
valvat-0.9.0 spec/valvat/checksum/si_spec.rb
valvat-0.8.2 spec/valvat/checksum/si_spec.rb