From 05ed98aa0c85fcf43298e0acdc25b51f2e4b37b4 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sun, 16 May 2021 13:23:26 +0100 Subject: [PATCH] Use :order_with_totals in ProcessPaymentIntent If we just use the :order factory here, it has no line items and no total, which means when we try to push it into complete state, the #requires_payment? check fails because the order total is zero, which means the call to #process_payments is ignored --- spec/services/process_payment_intent_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/services/process_payment_intent_spec.rb b/spec/services/process_payment_intent_spec.rb index bcf76d6240..8c55e84f7a 100644 --- a/spec/services/process_payment_intent_spec.rb +++ b/spec/services/process_payment_intent_spec.rb @@ -7,7 +7,9 @@ describe ProcessPaymentIntent do describe "processing a payment intent" do let(:customer) { create(:customer) } - let(:order) { create(:order, customer: customer, distributor: customer.enterprise, state: "payment") } + let(:order) { + create(:order_with_totals, customer: customer, distributor: customer.enterprise, state: "payment") + } let(:payment_method) { create(:stripe_sca_payment_method) } let!(:payment) { create( :payment,