1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-28 09:39:39 +02:00

Test fixes

This commit is contained in:
Zach Gollwitzer 2025-07-08 13:03:40 -04:00
parent 018310d4d1
commit 2e09d1a8c0
10 changed files with 126 additions and 25 deletions

View file

@ -8,26 +8,26 @@ class Api::V1::TransactionsControllerTest < ActionDispatch::IntegrationTest
@family = @user.family
@account = @family.accounts.first
@transaction = @family.transactions.first
# Destroy existing active API keys to avoid validation errors
@user.api_keys.active.destroy_all
# Create fresh API keys instead of using fixtures to avoid parallel test conflicts
@api_key = ApiKey.create!(
user: @user,
name: "Test Read-Write Key",
scopes: ["read_write"],
scopes: [ "read_write" ],
display_key: "test_rw_#{SecureRandom.hex(8)}"
)
@read_only_api_key = ApiKey.create!(
user: @user,
name: "Test Read-Only Key",
scopes: ["read"],
name: "Test Read-Only Key",
scopes: [ "read" ],
display_key: "test_ro_#{SecureRandom.hex(8)}",
source: "mobile" # Use different source to allow multiple keys
)
# Clear any existing rate limit data
Redis.new.del("api_rate_limit:#{@api_key.id}")
Redis.new.del("api_rate_limit:#{@read_only_api_key.id}")