Count the debug log entries on a refused Brex token

The transactions 403 path was tested for the sync outcome only, so a
capture moved above the credentials re-raise in fetch_and_store_transactions
went unnoticed and logged the failure twice. The syncer test now expects
exactly one entry, from BrexItem::Syncer.

Siblings: the accounts 401 path is already pinned by 'a credential failure
is logged once' in importer_test.rb; unchanged.
This commit is contained in:
jaysbeekay
2026-11-23 20:33:23 +02:00
parent a29e90dafa
commit e3ab39fc03
+4 -1
View File
@@ -167,11 +167,14 @@ class BrexItem::SyncerTest < ActiveSupport::TestCase
.raises(Provider::Brex::BrexError.new("Access forbidden", :access_forbidden, http_status: 403))
sync = Sync.create!(syncable: @brex_item)
sync.perform
assert_difference -> { DebugLogEntry.count }, 1 do
sync.perform
end
assert sync.reload.failed?, "expected the sync to fail, was #{sync.status}"
assert_equal I18n.t("brex_items.syncer.credentials_invalid"), sync.error
assert @brex_item.reload.requires_update?
assert_equal "BrexItem::Syncer", DebugLogEntry.where(provider_key: "brex").recent.first.source
end
private