Applies helpers to relevant specs

This commit is contained in:
filipefurtad0
2022-11-08 14:34:50 +00:00
parent 4b067e2ece
commit 1a3c4008fd
4 changed files with 15 additions and 7 deletions

View File

@@ -29,9 +29,7 @@ module StripeHelper
end
def stripe_enable
RSpec::Mocks.with_temporary_scope do
allow(Spree::Config).to receive(:stripe_connect_enabled).and_return(true)
end
allow(Spree::Config).to receive(:stripe_connect_enabled).and_return(true)
end
def with_stripe_setup(api_key = "sk_test_12345", publishable_key = "pk_test_12345")

View File

@@ -18,9 +18,11 @@ describe '
create(:stripe_account, enterprise: order.distributor, stripe_user_id: "abc123")
end
before { setup_stripe }
around do |example|
with_stripe_setup { example.run }
end
context "making a new Stripe payment", js: true do
context "making a new Stripe payment" do
before do
stub_payment_methods_post_request
stub_payment_intent_get_request

View File

@@ -30,8 +30,12 @@ describe "Check out with Stripe", js: true do
calculator: Calculator::FlatRate.new(preferred_amount: 5.67))
}
around do |example|
with_stripe_setup { example.run }
end
before do
setup_stripe
stripe_enable
set_order order
add_product_to_cart order, product
distributor.shipping_methods << [shipping_with_fee, free_shipping]

View File

@@ -644,8 +644,12 @@ describe "As a consumer, I want to checkout my order", js: true do
end
context "for Stripe SCA", if: pay_method.eql?("Stripe SCA") do
around do |example|
with_stripe_setup { example.run }
end
before do
setup_stripe
stripe_enable
visit checkout_step_path(:payment)
end