Sha256: d42c850f43a3ce7f32a844b41d1562c43990115d76900377e5a75fab251f2969

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Valvat::Checksum::GB do
  %w[GBGD100 GBHA600].each do |gov_agency_vat|
    it "returns true on valid VAT for government agency #{gov_agency_vat}" do
      expect(Valvat::Checksum.validate(gov_agency_vat)).to be true
    end
  end

  %w[GB000000000 GB000000000000].each do |invalid_vat|
    it 'is false for all zero number' do
      expect(Valvat::Checksum.validate(invalid_vat)).to be false
    end
  end

  it 'is true for an old format valid vat' do
    expect(Valvat::Checksum.validate('GB434031494')).to be true
  end

  it 'is true for a new format valid vat' do
    expect(Valvat::Checksum.validate('GB434031439')).to be true
    expect(Valvat::Checksum.validate('GB727255821')).to be true
  end

  it 'is false for an old format VAT in forbidden group' do
    expect(Valvat::Checksum.validate('GB999999973')).to be false
  end

  it 'is false for a new format VAT in forbidden group' do
    expect(Valvat::Checksum.validate('GB100000034')).to be false
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
valvat-1.4.1 spec/valvat/checksum/gb_spec.rb
valvat-1.4.0 spec/valvat/checksum/gb_spec.rb
valvat-1.3.0 spec/valvat/checksum/gb_spec.rb
valvat-1.2.1 spec/valvat/checksum/gb_spec.rb
valvat-1.2.0 spec/valvat/checksum/gb_spec.rb