Skip to content

Commit

Permalink
Add tests for newly added methods
Browse files Browse the repository at this point in the history
  • Loading branch information
chapmankyle committed Apr 25, 2024
1 parent 31ef733 commit fb24c4d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/ups/builders/rate_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def setup
builder.add_ship_to ship_to
builder.add_ship_from shipper
builder.add_package package
builder.add_return_service '10'
builder.add_shipment_delivery_confirmation '2'
builder.add_shipment_direct_delivery_only
end
Expand Down Expand Up @@ -38,6 +39,10 @@ def test_has_correct_package_weight
assert_equal package[:weight], @rate_builder.as_json['RateRequest']['Shipment']['Package'][0]['PackageWeight']['Weight']
end

def test_has_correct_return_service
assert_equal '10', @rate_builder.as_json['RateRequest']['Shipment']['ShipmentServiceOptions']['ReturnService']['Code']
end

def test_has_correct_delivery_confirmation
assert_equal '2', @rate_builder.as_json['RateRequest']['Shipment']['ShipmentServiceOptions']['DeliveryConfirmation']['DCISType']
end
Expand Down
15 changes: 15 additions & 0 deletions spec/ups/builders/ship_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def setup
builder.add_international_invoice invoice_form
builder.add_description 'Los Pollo Hermanos'
builder.add_reference_number reference_number
builder.add_return_service '10'
builder.add_usps_endorsement '1'
builder.add_package_id '1234'
builder.add_shipment_delivery_confirmation '2'
builder.add_shipment_direct_delivery_only
builder.add_invoice_line_total('12', "GBP")
Expand Down Expand Up @@ -66,6 +69,18 @@ def test_has_correct_reference_number
assert_equal reference_number[:code], @ship_builder.as_json['ShipmentRequest']['Shipment']['ReferenceNumber']['Code']
end

def test_has_correct_return_service
assert_equal '10', @ship_builder.as_json['ShipmentRequest']['Shipment']['ReturnService']['Code']
end

def test_has_correct_usps_endorsement
assert_equal '1', @ship_builder.as_json['ShipmentRequest']['Shipment']['USPSEndorsement']
end

def test_has_correct_package_id
assert_equal '1234', @ship_builder.as_json['ShipmentRequest']['Shipment']['PackageID']
end

def test_has_correct_delivery_confirmation
assert_equal '2', @ship_builder.as_json['ShipmentRequest']['Shipment']['ShipmentServiceOptions']['DeliveryConfirmation']['DCISType']
end
Expand Down

0 comments on commit fb24c4d

Please sign in to comment.