Sha256: a0f095708cdd3a5cdc6cfd407a490ed3169ff3cb0f35f6ad8ce99bcfd2c02ad8

Contents?: true

Size: 759 Bytes

Versions: 17

Compression:

Stored size: 759 Bytes

Contents

require 'spec_helper'

describe Valvat::Checksum::IT do
  %w(IT12345670785 IT01897810162 IT00197200132 IT02762750210).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..-3]}#{valid_vat[-1]}#{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 invalid special case vat IT12345671783" do
    expect(Valvat::Checksum.validate("IT12345671783")).to eql(false)
  end

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

Version data entries

17 entries across 17 versions & 1 rubygems

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