Sha256: ab49fec32b08675e66a43a3beaa0859ae45a12b7b5f7d048f26f777a638a1fbc

Contents?: true

Size: 642 Bytes

Versions: 6

Compression:

Stored size: 642 Bytes

Contents

require 'spec_helper'

describe Valvat::Checksum::SE do
  %w(SE136695975501 SE556464687401 SE502052817901 SE556555952201 SE556084097601).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[-3]}"

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

  it "returns false on special case invalid vat SE556464687400" do
    Valvat::Checksum.validate("SE556464687400").should eql(false)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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