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:
Gaetan Craig-Riou
2023-09-07 14:00:26 +02:00
parent b955e0b25d
commit 63cd8ccf28

View File

@@ -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