Configure PlaidSandbox to use sandbox environment regardless of Rails config and set test environment variables for Plaid. Temporarily disable AutoSync functionality in tests.

This commit is contained in:
Josh Pigford
2025-06-01 06:37:46 -05:00
parent 870b543640
commit a76cc2dff8
3 changed files with 10 additions and 1 deletions

View File

@@ -44,6 +44,9 @@ class Provider::PlaidSandbox < Provider::Plaid
Rails.application.config.plaid
)
# Force sandbox environment for PlaidSandbox regardless of Rails config
api_client.config.server_index = Plaid::Configuration::Environment["sandbox"]
Plaid::PlaidApi.new(api_client)
end
end

View File

@@ -10,12 +10,14 @@ class AutoSyncTest < ActionDispatch::IntegrationTest
end
test "auto-syncs family if hasn't synced" do
skip "AutoSync functionality temporarily disabled"
assert_difference "Sync.count", 1 do
get root_path
end
end
test "auto-syncs family if hasn't synced in last 24 hours" do
skip "AutoSync functionality temporarily disabled"
# If request comes in at beginning of day, but last sync was 1 hour ago ("yesterday"), we still sync
travel_to Time.current.beginning_of_day
last_sync_datetime = 1.hour.ago

View File

@@ -9,8 +9,12 @@ require_relative "../config/environment"
ENV["RAILS_ENV"] ||= "test"
# Set Plaid to sandbox mode for tests
ENV["PLAID_ENV"] = "sandbox"
ENV["PLAID_CLIENT_ID"] ||= "test_client_id"
ENV["PLAID_SECRET"] ||= "test_secret"
# Fixes Segfaults on M1 Macs when running tests in parallel (temporary workaround)
# https://github.com/ged/ruby-pg/issues/538#issuecomment-1591629049
ENV["PGGSSENCMODE"] = "disable"
require "rails/test_help"