Sha256: b05ee81b9c6a8b40921184031c5bfa962d5bec1c2c379a4622ed62a2e350b92a

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

require 'test_helper'

class USPSTrackingNumberTest < Minitest::Test
  context "a USPS tracking number" do
    ["9101 1234 5678 9000 0000 13", "7196 9010 7560 0307 7385", "9400 1112 0108 0805 4830 16", "9505 5110 6960 5048 6006 24", "9361 2898 7870 0317 6337 95"].each do |valid_number|
      should "return usps with valid 22 digit number: #{valid_number}" do
        should_be_valid_number(valid_number, TrackingNumber::USPS91, :usps)
      end

      should "detect #{valid_number} regardless of spacing" do
        should_detect_number_variants(valid_number, TrackingNumber::USPS91)
      end
    end

    ["0307 1790 0005 2348 3741"].each do |valid_number|
      should "return usps with valid 20 digit number: #{valid_number}" do
        should_be_valid_number(valid_number, TrackingNumber::USPS20, :usps)
      end

      should "detect #{valid_number} regardless of spacing" do
        should_detect_number_variants(valid_number, TrackingNumber::USPS20)
      end
    end

    ["RB123456785US"].each do |valid_number|
      should "return usps with valid 13 character number #{valid_number}" do
        should_be_valid_number(valid_number, TrackingNumber::USPS13, :usps)
      end

      should "detect #{valid_number} regardless of spacing" do
        should_detect_number_variants(valid_number, TrackingNumber::USPS13)
      end
    end

    ["420221539101026837331000039521"].each do |valid_number|
      should "return usps with valid 30 digit number: #{valid_number}" do
        should_be_valid_number(valid_number, TrackingNumber::USPS91, :usps)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tracking_number-0.9.1 test/usps_tracking_number_test.rb
tracking_number-0.9.0 test/usps_tracking_number_test.rb