Sha256: e50bea1fa0d5654bd0e09cfe6f9b6905c434df663a8f8c9909f5efb1c53fcf7e

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 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"].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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tracking_number-0.8.5 test/usps_tracking_number_test.rb