mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-31 21:37:16 +00:00
Implement required method
Most of the time this doesn't get called because source_required: false. But sometimes it [does happen](https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/66329690f4b6380007e8a4f8) I have a feeling that source_required? could be moved to the superclass as payment_source_class.present?. But I don't know enough about this area of the system to try it...
This commit is contained in:
committed by
filipefurtad0
parent
ffdbd0d7d4
commit
62fefd5d49
@@ -25,6 +25,10 @@ module Spree
|
||||
ActiveMerchant::Billing::Response.new(true, "", {}, {})
|
||||
end
|
||||
|
||||
def payment_source_class
|
||||
nil
|
||||
end
|
||||
|
||||
def source_required?
|
||||
false
|
||||
end
|
||||
|
||||
@@ -338,12 +338,11 @@ RSpec.describe CheckoutController, type: :controller do
|
||||
let!(:payment_method_id) { payment_method.id }
|
||||
|
||||
it "updates and redirects to summary step" do
|
||||
expect { put(:update, params:) }.to raise_error(RuntimeError, error_message)
|
||||
put(:update, params:)
|
||||
|
||||
# according to Bugsnag, we should get an error 500
|
||||
expect(response.status).to be 200
|
||||
expect(response).not_to redirect_to checkout_step_path(:summary)
|
||||
expect(order.reload.state).to eq "payment"
|
||||
expect(response.status).to be 302
|
||||
expect(response).to redirect_to checkout_step_path(:summary)
|
||||
expect(order.reload.state).to eq "confirmation"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user