Sha256: a67e6f7bdce8c2d50a2c8bb26e959003af311ad335884fd9e60ff69e2d5ac8eb

Contents?: true

Size: 551 Bytes

Versions: 11

Compression:

Stored size: 551 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Valvat::Checksum::NL do
  %w[NL123456782B12 NL802549391B01 NL808661863B01 NL820893559B01 NL000099998B57 NL123456789B13].each do |valid|
    it "returns true on valid VAT #{valid}" do
      expect(Valvat::Checksum.validate(valid)).to be(true)
    end

    invalid = "#{valid[0..-5]}#{valid[-2]}#{valid[-3]}#{valid[-4]}#{valid[-1]}#{valid[-2]}#{valid[-3]}"

    it "returns false on invalid VAT #{invalid}" do
      expect(Valvat::Checksum.validate(invalid)).to be(false)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
valvat-1.4.1 spec/valvat/checksum/nl_spec.rb
valvat-1.4.0 spec/valvat/checksum/nl_spec.rb
valvat-1.3.0 spec/valvat/checksum/nl_spec.rb
valvat-1.2.1 spec/valvat/checksum/nl_spec.rb
valvat-1.2.0 spec/valvat/checksum/nl_spec.rb
valvat-1.1.5 spec/valvat/checksum/nl_spec.rb
valvat-1.1.4 spec/valvat/checksum/nl_spec.rb
valvat-1.1.3 spec/valvat/checksum/nl_spec.rb
valvat-1.1.2 spec/valvat/checksum/nl_spec.rb
valvat-1.1.1 spec/valvat/checksum/nl_spec.rb
valvat-1.1.0 spec/valvat/checksum/nl_spec.rb