From a62e51c0d02e5b931ad9fc04bf1dc5e4985241eb Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Mon, 5 Jun 2023 19:59:09 +0100 Subject: [PATCH] Remove Order #refresh_shipment_rates method --- app/models/spree/order.rb | 4 ---- spec/controllers/admin/bulk_line_items_controller_spec.rb | 2 +- spec/factories/order_factory.rb | 2 +- spec/system/consumer/shopping/orders_spec.rb | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/models/spree/order.rb b/app/models/spree/order.rb index 66692ef1e7..6b3b463b7f 100644 --- a/app/models/spree/order.rb +++ b/app/models/spree/order.rb @@ -492,10 +492,6 @@ module Spree end end - def refresh_shipment_rates - shipments.map(&:refresh_rates) - end - # After changing line items of a completed order def update_shipping_fees! shipments.each do |shipment| diff --git a/spec/controllers/admin/bulk_line_items_controller_spec.rb b/spec/controllers/admin/bulk_line_items_controller_spec.rb index 4e31f4f12d..b0dc8c3bd4 100644 --- a/spec/controllers/admin/bulk_line_items_controller_spec.rb +++ b/spec/controllers/admin/bulk_line_items_controller_spec.rb @@ -377,7 +377,7 @@ describe Admin::BulkLineItemsController, type: :controller do line_item1.product.update_columns(tax_category_id: tax_cat5.id) line_item2.product.update_columns(tax_category_id: tax_cat10.id) - order.refresh_shipment_rates + order.shipments.map(&:refresh_rates) order.select_shipping_method(shipping_method.id) order.finalize! order.recreate_all_fees! diff --git a/spec/factories/order_factory.rb b/spec/factories/order_factory.rb index 0127bf2541..311c2043d8 100644 --- a/spec/factories/order_factory.rb +++ b/spec/factories/order_factory.rb @@ -76,7 +76,7 @@ FactoryBot.define do distributor { create(:distributor_enterprise) } - after(:create, &:refresh_shipment_rates) + after(:create) { |order, _evaluator| order.shipments.map(&:refresh_rates) } factory :order_ready_to_ship do payment_state { 'paid' } diff --git a/spec/system/consumer/shopping/orders_spec.rb b/spec/system/consumer/shopping/orders_spec.rb index 20ca151d3a..f8da05c9cb 100644 --- a/spec/system/consumer/shopping/orders_spec.rb +++ b/spec/system/consumer/shopping/orders_spec.rb @@ -120,7 +120,7 @@ describe "Order Management" do before do order.shipment.shipping_method.calculator.update(preferred_amount: 5.0) - order.refresh_shipment_rates + order.shipments.map(&:refresh_rates) order.save order.reload