test/unit/carriers/ups_test.rb in active_shipping-1.4.2 vs test/unit/carriers/ups_test.rb in active_shipping-1.4.3
- old
+ new
@@ -126,10 +126,16 @@
"ARRIVAL SCAN",
"OUT FOR DELIVERY",
"DELIVERED"], response.shipment_events.map(&:name)
end
+ def test_find_tracking_info_should_have_correct_type_codes_for_shipment_events
+ @carrier.expects(:commit).returns(@tracking_response)
+ response = @carrier.find_tracking_info('1Z5FX0076803466397')
+ assert_equal ["M", "I", "I", "I", "I", "I", "I", "D"], response.shipment_events.map(&:type_code)
+ end
+
def test_add_origin_and_destination_data_to_shipment_events_where_appropriate
@carrier.expects(:commit).returns(@tracking_response)
response = @carrier.find_tracking_info('1Z5FX0076803466397')
assert_equal '175 AMBASSADOR', response.shipment_events.first.location.address1
assert_equal 'K1N5X8', response.shipment_events.last.location.postal_code
@@ -533,7 +539,39 @@
assert response
end
def test_maximum_address_field_length
assert_equal 35, @carrier.maximum_address_field_length
+ end
+
+ def test_package_surepost_less_than_one_lb_service
+ xml_builder = Nokogiri::XML::Builder.new do |xml|
+ @carrier.send(:build_package_node,
+ xml,
+ package_fixtures[:small_half_pound],
+ {
+ :service => "92",
+ :imperial => true
+ }
+ )
+ end
+ request = Nokogiri::XML(xml_builder.to_xml)
+ assert_equal 'OZS', request.search('/Package/PackageWeight/UnitOfMeasurement/Code').text
+ assert_equal '8.0', request.search('/Package/PackageWeight/Weight').text
+ end
+
+ def test_package_surepost_less_than_one_lb_service_code
+ xml_builder = Nokogiri::XML::Builder.new do |xml|
+ @carrier.send(:build_package_node,
+ xml,
+ package_fixtures[:small_half_pound],
+ {
+ :service_code => "92",
+ :imperial => true
+ }
+ )
+ end
+ request = Nokogiri::XML(xml_builder.to_xml)
+ assert_equal 'OZS', request.search('/Package/PackageWeight/UnitOfMeasurement/Code').text
+ assert_equal '8.0', request.search('/Package/PackageWeight/Weight').text
end
end