mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user