1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00
Maybe/test/models/family/syncer_test.rb
2025-05-26 05:39:14 -04:00

30 lines
747 B
Ruby

require "test_helper"
class Family::SyncerTest < ActiveSupport::TestCase
setup do
@family = families(:dylan_family)
end
test "syncs plaid items and manual accounts" do
family_sync = syncs(:family)
manual_accounts_count = @family.accounts.manual.count
items_count = @family.plaid_items.count
syncer = Family::Syncer.new(@family)
Account.any_instance
.expects(:sync_later)
.with(parent_sync: family_sync)
.times(manual_accounts_count)
PlaidItem.any_instance
.expects(:sync_later)
.with(parent_sync: family_sync)
.times(items_count)
syncer.perform_sync(family_sync)
assert_equal "completed", family_sync.reload.status
end
end