From 2f7ef33cafe5fcc2f7f9b5e1d44234c1d19be99b Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Fri, 14 Jan 2022 19:29:12 +0000 Subject: [PATCH] Add test for maintaining hub selection after order completion --- spec/system/consumer/split_checkout_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb index b544c033b6..2fb01311dd 100644 --- a/spec/system/consumer/split_checkout_spec.rb +++ b/spec/system/consumer/split_checkout_spec.rb @@ -221,6 +221,25 @@ describe "As a consumer, I want to checkout my order", js: true do expect(page).to have_content("Select a shipping method") end end + + context "summary step" do + let(:order) { create(:order_ready_for_confirmation, distributor: distributor) } + + describe "completing the checkout" do + it "keeps the distributor selected for the current user after completion" do + visit checkout_step_path(:summary) + + expect(page).to have_content "Shopping @ #{distributor.name}" + + click_on "Complete order" + + expect(page).to have_content "Back To Store" + expect(order.reload.state).to eq "complete" + + expect(page).to have_content "Shopping @ #{distributor.name}" + end + end + end end context "when I have an out of stock product in my cart" do