From 63cd8ccf286ae7d19aa4bda3d67eea5dad0458d1 Mon Sep 17 00:00:00 2001 From: Gaetan Craig-Riou Date: Thu, 7 Sep 2023 14:00:26 +0200 Subject: [PATCH] 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. --- spec/system/consumer/split_checkout_spec.rb | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb index 1ee0350fae..c7c9b93f53 100644 --- a/spec/system/consumer/split_checkout_spec.rb +++ b/spec/system/consumer/split_checkout_spec.rb @@ -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