Handle duplicate sync jobs

This commit is contained in:
Zach Gollwitzer
2025-05-24 17:58:17 -04:00
parent aecb5aafd8
commit 5125411822
2 changed files with 17 additions and 0 deletions

View File

@@ -3,6 +3,17 @@ require "test_helper"
class SyncTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
test "does not run if not in a valid state" do
syncable = accounts(:depository)
sync = Sync.create!(syncable: syncable, status: :completed)
syncable.expects(:perform_sync).never
sync.perform
assert_equal "completed", sync.status
end
test "runs successful sync" do
syncable = accounts(:depository)
sync = Sync.create!(syncable: syncable)