Merge pull request #7316 from Matt-Yorkley/dead-code-shipments

DCOTW: #ensure_updated_shipments
This commit is contained in:
Pau Pérez Fabregat
2021-04-09 08:03:24 +02:00
committed by GitHub
2 changed files with 0 additions and 29 deletions

View File

@@ -541,21 +541,6 @@ module Spree
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

View File

@@ -392,20 +392,6 @@ describe Spree::Order do
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 }