Skip to content

Commit

Permalink
fix shipment_spec by sorting the returned refresh_rates
Browse files Browse the repository at this point in the history
  • Loading branch information
abdellani committed Jan 19, 2023
1 parent a5c4b4f commit 729c4e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/models/spree/shipment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@
# the second call is for the shippping method after the Estimator was executed
allow(shipment).to receive(:shipping_method).and_return(shipping_method2, shipping_method1)

expect(shipment.refresh_rates).to eq shipping_rates
expect(shipment.refresh_rates.sort).to eq shipping_rates.sort
expect(shipment.reload.selected_shipping_rate.shipping_method_id).to eq shipping_method2.id
end

it 'should handle no shipping_method selection' do
expect(OrderManagement::Stock::Estimator).
to receive(:new).with(shipment.order).and_return(mock_estimator)
allow(shipment).to receive_messages(shipping_method: nil)
expect(shipment.refresh_rates).to eq shipping_rates
expect(shipment.refresh_rates.sort).to eq shipping_rates.sort
expect(shipment.reload.selected_shipping_rate).to_not be_nil
end

Expand Down
1 change: 1 addition & 0 deletions spec/system/admin/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ def new_order_with_distribution(distributor, order_cycle)
order.shipments.each(&:refresh_rates)
order.select_shipping_method(different_shipping_method_for_distributor1)
end

it do
visit spree.edit_admin_order_path(order)
expect(page).to have_content different_shipping_method_for_distributor1.name
Expand Down

0 comments on commit 729c4e2

Please sign in to comment.