diff --git a/backend/app/controllers/spree/admin/orders_controller.rb b/backend/app/controllers/spree/admin/orders_controller.rb index 4d85559164b..498d4eb4c3e 100644 --- a/backend/app/controllers/spree/admin/orders_controller.rb +++ b/backend/app/controllers/spree/admin/orders_controller.rb @@ -76,16 +76,9 @@ def new def edit require_ship_address - - unless @order.completed? - @order.refresh_shipment_rates - end end def cart - unless @order.completed? - @order.refresh_shipment_rates - end if @order.shipped_shipments.count > 0 redirect_to edit_admin_order_url(@order) end diff --git a/backend/spec/controllers/spree/admin/orders_controller_spec.rb b/backend/spec/controllers/spree/admin/orders_controller_spec.rb index 64eef8b8b67..1e8ea277684 100644 --- a/backend/spec/controllers/spree/admin/orders_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/orders_controller_spec.rb @@ -113,6 +113,7 @@ end # Regression test for https://github.com/spree/spree/issues/3684 + # Rendering a form should under no circumstance mutate the order context "#edit" do it "does not refresh rates if the order is completed" do allow(order).to receive_messages completed?: true @@ -120,9 +121,9 @@ get :edit, params: { id: order.number } end - it "does refresh the rates if the order is incomplete" do + it "does not refresh the rates if the order is incomplete" do allow(order).to receive_messages completed?: false - expect(order).to receive :refresh_shipment_rates + expect(order).not_to receive :refresh_shipment_rates get :edit, params: { id: order.number } end