Sha256: 1497b3ec9d0b37cf0c4d827c050c15a25efb97f11b79b8435ee21881898068cb

Contents?: true

Size: 789 Bytes

Versions: 14

Compression:

Stored size: 789 Bytes

Contents

require 'spec_helper'

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

    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

14 entries across 14 versions & 1 rubygems

Version Path
valvat-0.8.1 spec/valvat/checksum/si_spec.rb
valvat-0.8.0 spec/valvat/checksum/si_spec.rb
valvat-0.7.4 spec/valvat/checksum/si_spec.rb
valvat-0.7.3 spec/valvat/checksum/si_spec.rb
valvat-0.7.2 spec/valvat/checksum/si_spec.rb
valvat-0.7.1 spec/valvat/checksum/si_spec.rb
valvat-0.7.0 spec/valvat/checksum/si_spec.rb
valvat-0.6.11 spec/valvat/checksum/si_spec.rb
valvat-0.6.10 spec/valvat/checksum/si_spec.rb
valvat-0.6.9 spec/valvat/checksum/si_spec.rb
valvat-0.6.8 spec/valvat/checksum/si_spec.rb
valvat-0.6.7 spec/valvat/checksum/si_spec.rb
valvat-0.6.6 spec/valvat/checksum/si_spec.rb
valvat-0.6.5 spec/valvat/checksum/si_spec.rb