Fix infinite loop in spec

The spec was setting the order's state to "complete" but didn't save
that state to the database. The new locking mechanism is was reloading
the order which loaded the cart state again. And since the order.next
method was mocked to just return true, the controller was trying to do
that in an infinite loop.
This commit is contained in:
Maikel Linke
2019-11-13 10:25:09 +11:00
parent ec1b5a7a92
commit dc122a9450

View File

@@ -130,6 +130,7 @@ describe CheckoutController, type: :controller do
context 'when completing the order' do
before do
order.state = 'complete'
order.save!
allow(order).to receive(:update_attributes).and_return(true)
allow(order).to receive(:next).and_return(true)
allow(order).to receive(:set_distributor!).and_return(true)