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