Sha256: 909f993a419dc165d0fe1b58c2418761daa34a1c375d2849663e6e4f59e882ec

Contents?: true

Size: 528 Bytes

Versions: 6

Compression:

Stored size: 528 Bytes

Contents

require 'spec_helper'

describe Valvat::Checksum::BG do
  %w(BG123456786 BG926067143 BG926067770 BG0101011739 BG0121013021 BG5041019992 BG1521687837 BG1431889037).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..-4]}#{valid_vat[-1]}#{valid_vat[-2]}#{valid_vat[-4]}"

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

Version data entries

6 entries across 6 versions & 1 rubygems

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