Sha256: a2bbf06bc2cc180a5ad1b7881b48f36326fd5cf8faf99781a236ed31d2bcf7c6

Contents?: true

Size: 743 Bytes

Versions: 6

Compression:

Stored size: 743 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
      Valvat::Checksum.validate(valid_vat).should eql(true)
    end

    invalid_vat = "#{valid_vat[0..-3]}#{valid_vat[-1]}#{valid_vat[-2]}"

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

  it "returns false on invalid special case vat IT12345671783" do
    Valvat::Checksum.validate("IT12345671783").should eql(false)
  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
valvat-0.6.4 spec/valvat/checksum/it_spec.rb
valvat-0.6.3 spec/valvat/checksum/it_spec.rb
valvat-0.6.2 spec/valvat/checksum/it_spec.rb
valvat-0.6.1 spec/valvat/checksum/it_spec.rb
valvat-0.6.0 spec/valvat/checksum/it_spec.rb
valvat-0.5.0 spec/valvat/checksum/it_spec.rb