Replace mocking on tested order object

It's more realistic this way.
This commit is contained in:
Maikel Linke
2024-07-02 16:57:07 +10:00
parent 2e36c699f6
commit a37b0eb698

View File

@@ -240,12 +240,12 @@ RSpec.describe Spree::Order do
end
it "should change the shipment state to ready if order is paid" do
Spree::Shipment.create(order:)
order.shipments.reload
order = create(:order_ready_for_confirmation)
allow(order).to receive_messages(paid?: true, complete?: true)
order.finalize!
order.payments.first.capture!
order.next! # calls `finalize!`
order.reload # reload so we're sure the changes are persisted
expect(order.shipment_state).to eq 'ready'
end