mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-12 23:27:48 +00:00
Stub OrderPaymentFinder to return correct object
OrderPaymentFinder was re-fetching the payment object from the database, so the subsequent line that stubs #authorize! on that payment was not being applied to the correct object.
This commit is contained in:
@@ -38,6 +38,8 @@ describe Checkout::StripeRedirect do
|
||||
it "returns the redirect path" do
|
||||
stripe_payment = create(:payment, payment_method_id: payment_method.id)
|
||||
order.payments << stripe_payment
|
||||
allow(OrderPaymentFinder).to receive_message_chain(:new, :last_pending_payment).
|
||||
and_return(stripe_payment)
|
||||
allow(stripe_payment).to receive(:authorize!) do
|
||||
# Authorization moves the payment state from checkout/processing to pending
|
||||
stripe_payment.state = 'pending'
|
||||
|
||||
Reference in New Issue
Block a user