From 3c4b5a255a54e7818b8d1bdbd8827d4107115ede Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 22 Feb 2022 17:05:14 +0000 Subject: [PATCH] Adds Stripe SCA to shared examples block --- spec/system/consumer/split_checkout_spec.rb | 30 ++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb index af9aed660081..17965917a356 100644 --- a/spec/system/consumer/split_checkout_spec.rb +++ b/spec/system/consumer/split_checkout_spec.rb @@ -6,6 +6,8 @@ include ShopWorkflow include SplitCheckoutHelper include FileHelper + include StripeHelper + include StripeStubs let!(:zone) { create(:zone_with_member) } let(:supplier) { create(:supplier_enterprise) } @@ -303,22 +305,42 @@ ) end - before do - visit checkout_step_path(:payment) - end + context "like #{pay_method}", if: pay_method.eql?("Stripe SCA") == false do + before do + visit checkout_step_path(:payment) + end - context "like #{pay_method}" do it "selects it and proceeds to the summary step" do choose pay_method.to_s click_on "Next - Order summary" expect(page).to have_content "Shopping @ #{distributor.name}" end end + + context "for Stripe SCA", if: pay_method.eql?("Stripe SCA") do + let!(:stripe_account) { create(:stripe_account, enterprise: distributor) } + let!(:stripe_sca_payment_method) { + create(:stripe_sca_payment_method, distributors: [distributor], name: "Stripe SCA") + } + + before do + setup_stripe + visit checkout_step_path(:payment) + end + + it "selects Stripe SCA and proceeds to the summary step" do + choose pay_method.to_s + fill_out_card_details + click_on "Next - Order summary" + expect(page).to have_content "Shopping @ #{distributor.name}" + end + end end describe "shared examples" do context "legacy checkout" do it_behaves_like "bewteen different payment methods", "Cash" it_behaves_like "bewteen different payment methods", "Paypal" + it_behaves_like "bewteen different payment methods", "Stripe SCA" end end end