diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index ec9721a33dd..92cdece3307 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -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 diff --git a/spec/models/spree/order_spec.rb b/spec/models/spree/order_spec.rb index 182c790f7e9..09307949f1a 100644 --- a/spec/models/spree/order_spec.rb +++ b/spec/models/spree/order_spec.rb @@ -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