Sha256: 5873939ee21b475826f4621b80ac881edfe80172185eb678f58b8973d442efe9

Contents?: true

Size: 676 Bytes

Versions: 6

Compression:

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

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