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

[Spree Upgrade] Destroy all shipments when clearing order #2767

Merged
merged 1 commit into from
Sep 26, 2018
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
2 changes: 1 addition & 1 deletion app/models/spree/order_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def disallow_guest_order
def empty_with_clear_shipping_and_payments!
empty_without_clear_shipping_and_payments!
payments.clear
update_attributes(shipping_method_id: nil)
shipments.destroy_all
end
alias_method_chain :empty!, :clear_shipping_and_payments

Expand Down
8 changes: 4 additions & 4 deletions spec/models/spree/order_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -387,18 +387,18 @@
end

describe "emptying the order" do
it "removes shipping method" do
subject.shipments = [create(:shipment)]
it "removes shipments" do
subject.shipments << create(:shipment)
subject.save!
subject.empty!
subject.shipping_method.should == nil
expect(subject.shipments).to be_empty
end

it "removes payments" do
subject.payments << create(:payment)
subject.save!
subject.empty!
subject.payments.should == []
expect(subject.payments).to be_empty
end
end

Expand Down