From dc122a9450658700746ae67a85e062529d1040bd Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 13 Nov 2019 10:25:09 +1100 Subject: [PATCH] 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. --- spec/controllers/checkout_controller_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/controllers/checkout_controller_spec.rb b/spec/controllers/checkout_controller_spec.rb index b1c01f90f2..3c0738f0b9 100644 --- a/spec/controllers/checkout_controller_spec.rb +++ b/spec/controllers/checkout_controller_spec.rb @@ -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)