mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Test scenario where a voucher is deactivated before end of checkout
A customer should be able to complete the checkout even if the voucher has been deactivated after being added to the order.
This commit is contained in:
@@ -1134,16 +1134,29 @@ describe "As a consumer, I want to checkout my order" do
|
||||
|
||||
before do
|
||||
add_voucher_to_order(voucher, order)
|
||||
|
||||
visit checkout_step_path(:summary)
|
||||
end
|
||||
|
||||
it "shows the applied voucher" do
|
||||
visit checkout_step_path(:summary)
|
||||
|
||||
within ".summary-right" do
|
||||
expect(page).to have_content "some_code"
|
||||
expect(page).to have_content "-6"
|
||||
end
|
||||
end
|
||||
|
||||
context "with voucher deactivated after being added to an order" do
|
||||
it "completes the order" do
|
||||
visit checkout_step_path(:summary)
|
||||
|
||||
# Deactivate voucher
|
||||
voucher.destroy
|
||||
|
||||
place_order
|
||||
|
||||
expect(order.reload.state).to eq "complete"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user