Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Isolate controller job assertions from daily auto-sync (#4482)

Sure Admin (bot)42c34344fe47
diff --git a/test/controllers/rules_controller_test.rb b/test/controllers/rules_controller_test.rb
index 6b178f2283..9c3cc43d50 100644
--- a/test/controllers/rules_controller_test.rb
+++ b/test/controllers/rules_controller_test.rb
@@ -3,6 +3,8 @@ require "test_helper"
class RulesControllerTest < ActionDispatch::IntegrationTest
include EntriesTestHelper
setup do
+ # Exercise controller jobs independently of the daily login sync.
+ families(:dylan_family).update!(auto_sync_on_login: false)
sign_in @user = users(:family_admin)
end
@@ -512,6 +514,8 @@ class RulesControllerTest < ActionDispatch::IntegrationTest
end
test "guest cannot apply rule" do
+ # Keep the fixture sync on yesterday to cover runs that cross midnight.
+ families(:dylan_family).syncs.update_all(created_at: 1.day.ago)
sign_in family_guest
rule = rules(:one)
diff --git a/test/controllers/settings/providers_controller_test.rb b/test/controllers/settings/providers_controller_test.rb
index f458ed9eab..af30dd67b4 100644
--- a/test/controllers/settings/providers_controller_test.rb
+++ b/test/controllers/settings/providers_controller_test.rb
@@ -6,6 +6,8 @@ class Settings::ProvidersControllerTest < ActionDispatch::IntegrationTest
include FinancekitTestHelper
setup do
+ # Exercise controller jobs independently of the daily login sync.
+ families(:dylan_family).update!(auto_sync_on_login: false)
ensure_tailwind_build
sign_in users(:family_admin)
@@ -779,6 +781,8 @@ class Settings::ProvidersControllerTest < ActionDispatch::IntegrationTest
end
test "POST sync for ibkr without an active Ibkr sync enqueues SyncJob" do
+ # Keep the fixture sync on yesterday to cover runs that cross midnight.
+ families(:dylan_family).syncs.update_all(created_at: 1.day.ago)
item = ibkr_items(:configured_item)
Sync.where(syncable_type: "IbkrItem", syncable_id: item.id).delete_all
diff --git a/test/controllers/sophtron_items_controller_test.rb b/test/controllers/sophtron_items_controller_test.rb
index b24ddfb5d9..39d5bda476 100644
--- a/test/controllers/sophtron_items_controller_test.rb
+++ b/test/controllers/sophtron_items_controller_test.rb
@@ -2,6 +2,8 @@ require "test_helper"
class SophtronItemsControllerTest < ActionDispatch::IntegrationTest
setup do
+ # Exercise controller jobs independently of the daily login sync.
+ families(:dylan_family).update!(auto_sync_on_login: false)
sign_in @user = users(:family_admin)
@item = @user.family.sophtron_items.create!(
name: "Sophtron",
@@ -678,6 +680,8 @@ class SophtronItemsControllerTest < ActionDispatch::IntegrationTest
end
test "manual sync starts Sophtron refresh and renders MFA challenge" do
+ # Keep the fixture sync on yesterday to cover runs that cross midnight.
+ families(:dylan_family).syncs.update_all(created_at: 1.day.ago)
@item.update!(user_institution_id: "ui-1")
sophtron_account = @item.sophtron_accounts.create!(
account_id: "acct-1",