Sha256: c6898c53d853ed5f8e6db9aaa3142f4ec8b0c481e43c0170ad659bfb2e7a5098

Contents?: true

Size: 688 Bytes

Versions: 6

Compression:

Stored size: 688 Bytes

Contents

require 'spec_helper'

begin
  require File.dirname(__FILE__) + '/../../tmp/valid_vat_numbers.rb'
rescue LoadError
  VALID_VAT_NUMBERS = []
end

describe Valvat::Checksum do
  describe "#validate" do
    it "returns true on vat number with unknown checksum algorithm" do
      expect(Valvat::Checksum.validate("FR99123543267")).to eql(true)
    end

    it "returns false on corrupt number (e.g checks syntax)" do
      expect(Valvat::Checksum.validate("FI1234567891")).to eql(false)
    end

    VALID_VAT_NUMBERS.each do |valid_vat|
      it "returns true on valid vat number #{valid_vat}" do
        expect(Valvat::Checksum.validate(valid_vat)).to eql(true)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
valvat-0.6.10 spec/valvat/checksum_spec.rb
valvat-0.6.9 spec/valvat/checksum_spec.rb
valvat-0.6.8 spec/valvat/checksum_spec.rb
valvat-0.6.7 spec/valvat/checksum_spec.rb
valvat-0.6.6 spec/valvat/checksum_spec.rb
valvat-0.6.5 spec/valvat/checksum_spec.rb