Files
sure/test/jobs/sync_job_test.rb
copilot-swe-agent[bot] 5b9bf3da61 Fix SyncJob test to properly verify retry_on configuration
Changed test from attempting to raise the error (which retry_on catches)
to verifying the job has a rescue handler configured for RateLimitError.

Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
2026-01-26 16:52:47 +00:00

25 lines
774 B
Ruby

require "test_helper"
class SyncJobTest < ActiveJob::TestCase
test "sync is performed" do
syncable = accounts(:depository)
sync = syncable.syncs.create!(window_start_date: 2.days.ago.to_date)
sync.expects(:perform).once
SyncJob.perform_now(sync)
end
test "configured to retry on TwelveData rate limit error" do
# Verify that SyncJob has a rescue handler for Provider::TwelveData::RateLimitError
# The retry_on declaration adds a rescue_from handler
handler_found = SyncJob.rescue_handlers.any? do |handler|
handler.is_a?(Hash) &&
handler[:exception] == Provider::TwelveData::RateLimitError
end
assert handler_found, "SyncJob should have retry_on configured for Provider::TwelveData::RateLimitError"
end
end