Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DCOTW: #ensure_updated_shipments #7316

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions spec/models/spree/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down