Attempt to spec for error

It didn't catch the error I was looking for. I'm not sure if it is a valid use case, but it still seems helpful to add coverage for current functionality.
This commit is contained in:
David Cook
2024-07-22 15:48:21 +10:00
parent 756a469a41
commit 0f923405cb

View File

@@ -328,6 +328,23 @@ RSpec.describe CheckoutController, type: :controller do
expect_cable_ready_redirect(response)
end
end
context "with existing invalid payments" do
let(:invalid_payments) { [
create(:payment, state: :failed),
create(:payment, state: :void),
] }
before do
order.payments = invalid_payments
end
it "deletes invalid payments" do
expect{
put(:update, params:)
}.to change { order.payments.to_a }.from(invalid_payments)
end
end
end
context "with no payment source" do