Skip to content

Commit

Permalink
Adds Stripe SCA to shared examples block
Browse files Browse the repository at this point in the history
  • Loading branch information
filipefurtad0 committed Feb 22, 2022
1 parent 6b18401 commit 3c4b5a2
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions spec/system/consumer/split_checkout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3c4b5a2

Please sign in to comment.