Adds condition to set Stripe.api key

Updates spec accordingly
This commit is contained in:
filipefurtad0
2024-02-02 16:09:33 +00:00
parent 949f7ef4d4
commit ecc5bbd0ed
2 changed files with 1 additions and 4 deletions

View File

@@ -12,6 +12,7 @@ end
Rails.application.reloader.to_prepare do
Stripe.api_key = ENV['STRIPE_INSTANCE_SECRET_KEY']
Stripe.api_key = ENV['STRIPE_SECRET_TEST_API_KEY'] if Rails.env.test? || ENV["CI"]
Stripe.publishable_key = ENV['STRIPE_INSTANCE_PUBLISHABLE_KEY']
Stripe.client_id = ENV['STRIPE_CLIENT_ID']
Stripe.endpoint_secret = ENV['STRIPE_ENDPOINT_SECRET']

View File

@@ -4,16 +4,12 @@ require 'spec_helper'
require 'stripe/credit_card_remover'
describe Stripe::CreditCardRemover do
let!(:secret) { ENV.fetch('STRIPE_SECRET_TEST_API_KEY', nil) }
let(:credit_card) { create(:credit_card, gateway_payment_profile_id: pm_card.id, user:) }
let!(:user) { create(:user, email: "apple.customer@example.com") }
let!(:enterprise) { create(:enterprise) }
describe "#remove", :vcr, :stripe_version do
before { Stripe.api_key = secret }
let(:stripe_account_id) { ENV.fetch('STRIPE_ACCOUNT', nil) }
let(:stripe_account) {