mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Applies helpers to relevant specs
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user