mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-28 21:07:16 +00:00
covers payment_state changes from item deletion
This commit is contained in:
@@ -84,6 +84,19 @@ describe LineItemsController, type: :controller do
|
||||
expect(response.status).to eq 204
|
||||
expect { item.reload }.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
context "after a payment is captured" do
|
||||
let(:payment) { create(:check_payment, amount: order.total, order: order, state: 'completed') }
|
||||
before { payment.capture! }
|
||||
|
||||
it 'updates the payment state' do
|
||||
expect(order.payment_state).to eq 'paid'
|
||||
delete :destroy, params
|
||||
expect(response.status).to eq 204
|
||||
order.update!
|
||||
expect(order.payment_state).to eq 'credit_owed'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user