diff --git a/core/lib/spree/testing_support/factories/order_factory.rb b/core/lib/spree/testing_support/factories/order_factory.rb index 722b31be90e..7884426922f 100644 --- a/core/lib/spree/testing_support/factories/order_factory.rb +++ b/core/lib/spree/testing_support/factories/order_factory.rb @@ -119,6 +119,8 @@ shipped_at: Time.current ) end + # We need to update the shipment_state after all callbacks have run + order.update_columns(shipment_state: 'shipped') order.reload end end diff --git a/core/spec/lib/spree/core/testing_support/factories/order_factory_spec.rb b/core/spec/lib/spree/core/testing_support/factories/order_factory_spec.rb index 7975f2ba8ae..44c511464ef 100644 --- a/core/spec/lib/spree/core/testing_support/factories/order_factory_spec.rb +++ b/core/spec/lib/spree/core/testing_support/factories/order_factory_spec.rb @@ -201,7 +201,8 @@ expect(order).to have_attributes( total: 110, payment_total: 110, - payment_state: "paid" + payment_state: "paid", + shipment_state: "shipped" ) expect(order.payments.count).to eq 1