Sha256: c9a4046df6c3e8d59d38ba4e46a960f712d7e4d1b034d28aa541ea50501e751b

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

require 'test_helper'
require 'russianpost/barcode'

module RussianPost
  class BarcodeTest < Minitest::Test
    def test_implicitly_converts_to_string
      barcode = Barcode.new('RD025500807SE')
      assert_equal 'bar RD025500807SE', "bar #{barcode}"
    end

    def test_validates_barcode
      ['123', 'RR123456789EE', 'RD025500807SP'].each do |barcode|
        refute Barcode.new(barcode).valid?
      end

      ['RD025500807SE', '62009147017544'].each do |barcode|
        assert Barcode.new(barcode).valid?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
russianpost-0.7.0 test/russianpost/barcode_test.rb