From c895153b581b751ea641ba1b3aeefdbec2ac8520 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sat, 3 Apr 2021 19:47:34 +0100 Subject: [PATCH] Remove dead code: #ensure_updated_shipments --- app/models/spree/order.rb | 15 --------------- spec/models/spree/order_spec.rb | 14 -------------- 2 files changed, 29 deletions(-) diff --git a/app/models/spree/order.rb b/app/models/spree/order.rb index faac4a70897..faeaf607a19 100644 --- a/app/models/spree/order.rb +++ b/app/models/spree/order.rb @@ -541,21 +541,6 @@ def create_proposed_shipments shipments end - # Clean shipments and make order back to address state - # - # At some point the might need to force the order to transition from address - # to delivery again so that proper updated shipments are created. - # e.g. customer goes back from payment step and changes order items - def ensure_updated_shipments - return unless shipments.any? - - shipments.destroy_all - update_columns( - state: "address", - updated_at: Time.zone.now - ) - end - def refresh_shipment_rates shipments.map(&:refresh_rates) end diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index 58895613e91..4c0de218fc6 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -392,20 +392,6 @@ end end - context "ensure shipments will be updated" do - before { Spree::Shipment.create!(order: order) } - - it "destroys current shipments" do - order.ensure_updated_shipments - expect(order.shipments).to be_empty - end - - it "puts order back in address state" do - order.ensure_updated_shipments - expect(order.state).to eql "address" - end - end - describe ".tax_address" do before { Spree::Config[:tax_using_ship_address] = tax_using_ship_address } subject { order.tax_address }