Fix SubscriptionConfirmJob spec

Fix the payment stubbing, payment `process_offline!` was stubbed to
return true and payment `completed?` was also stubbed to return true.
`process_offline!` did not change the payment status in the database,
meaning that any call to 'order.pending_payments' after that would
return the payment which should have been processed offline, and
therefore completed. This created some unwanted side effect, resulting
in the test breaking.
This commit is contained in:
Gaetan Craig-Riou
2024-02-07 15:27:51 +11:00
parent c11d30eb13
commit 5fd36e7eed

View File

@@ -239,8 +239,11 @@ describe SubscriptionConfirmJob do
context "when payments are processed without error" do
before do
expect(payment).to receive(:process_offline!) { true }
expect(payment).to receive(:completed?) { true }
allow(payment).to receive(:process_offline!) do
# Mark payment as complete like it would be if sucessfully processed offline
payment.state = "complete"
true
end
end
it "sends only a subscription confirm email, no regular confirmation emails" do