Sha256: b78df7241e3add721685e62454c7032fc10f5eb890822882ef8fcc0264b39756

Contents?: true

Size: 1.48 KB

Versions: 67

Compression:

Stored size: 1.48 KB

Contents

require 'test_helper'

class TrackingResponseTest < ActiveSupport::TestCase
  def test_equality
    options1 = {
      carrier: 'usps',
      status: 'DELIVERED',
      status_code: 'I0',
      status_description: 'DELIVERED',
      actual_delivery_date: DateTime.parse("Sat 14 May 2016 13:20:00"),
      tracking_number: 'TRACKINGNUMBER1234ABC',
      shipment_events: [
        ShipmentEvent.new(
          'DELIVERED',
          DateTime.parse("Sat 14 May 2016 13:20:00"),
          Location.new(city: 'LOS ANGELES', state: 'CA', postal_code: '90210', country: 'US'),
          'DELIVERED',
          'I0'
        ),
        ShipmentEvent.new(
          'ARRIVED AT UNIT',
          DateTime.parse("Thu 12 May 2016 05:45:00"),
          Location.new(city: 'SAN JOSE', state: 'CA', postal_code: '90001', country: 'US'),
          'ARRIVED AT UNIT',
          '07'
        )
      ],
      destination: Location.new(postal_code: '90210'),
      origin: Location.new(postal_code: '00001')
    }
    # Deep copies options1 to create new ShipmentEvent, Location, etc. objects to check for similar distinct objects
    options2 = Marshal.load(Marshal.dump(options1))
    options2[:shipment_events][0], options2[:shipment_events][1] =
      options2[:shipment_events][1], options2[:shipment_events][0]

    tracking_response_1 = TrackingResponse.new(true, nil, {}, options1)
    tracking_response_2 = TrackingResponse.new(true, nil, {}, options2)

    assert_equal tracking_response_1, tracking_response_2
  end
end

Version data entries

67 entries across 67 versions & 3 rubygems

Version Path
workarea-core-3.5.27 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.5.26 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.4.45 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.5.25 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.5.23 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.4.44 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.5.22 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.4.43 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.5.21 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.4.42 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.5.20 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.4.41 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.5.19 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.4.40 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.5.18 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.4.39 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.5.17 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.4.38 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.5.16 vendor/active_shipping/test/unit/tracking_response_test.rb
workarea-core-3.4.37 vendor/active_shipping/test/unit/tracking_response_test.rb