mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Fix JS error when Stripe connect is disabled but Stripe API keys are setup
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
= inject_json_array("shops", @shops.all, Api::ShopForOrdersSerializer)
|
||||
= inject_saved_credit_cards
|
||||
|
||||
- if Stripe.publishable_key
|
||||
- if Spree::Config.stripe_connect_enabled && Stripe.publishable_key
|
||||
:javascript
|
||||
angular.module('Darkswarm').value("stripeObject", Stripe("#{Stripe.publishable_key}"))
|
||||
angular.module('Darkswarm').value("stripePublishableKey", "#{Stripe.publishable_key}")
|
||||
|
||||
@@ -112,6 +112,21 @@ RSpec.describe '
|
||||
end
|
||||
end
|
||||
|
||||
context "with Stripe setup" do
|
||||
include StripeHelper
|
||||
|
||||
around do |example|
|
||||
with_stripe_setup { example.call }
|
||||
end
|
||||
|
||||
it "does not cause js errors even if Stripe connect is disabled" do
|
||||
allow(Spree::Config).to receive(:stripe_connect_enabled).and_return(false)
|
||||
|
||||
visit "/account"
|
||||
expect(page).to have_content "My account"
|
||||
end
|
||||
end
|
||||
|
||||
context "as a disabled user" do
|
||||
before do
|
||||
user.disabled = '1'
|
||||
|
||||
Reference in New Issue
Block a user