Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Enque account sync job after creating transfer (#946)

Tony Vincent48092cb70416
diff --git a/app/controllers/account/transfers_controller.rb b/app/controllers/account/transfers_controller.rb
index 13a7ea8b..a494285c 100644
--- a/app/controllers/account/transfers_controller.rb
+++ b/app/controllers/account/transfers_controller.rb
@@ -18,6 +18,7 @@ class Account::TransfersController < ApplicationController
name: transfer_params[:name]
if @transfer.save
+ @transfer.entries.each(&:sync_account_later)
redirect_to transactions_path, notice: t(".success")
else
# TODO: this is not an ideal way to handle errors and should eventually be improved.
diff --git a/test/controllers/account/transfers_controller_test.rb b/test/controllers/account/transfers_controller_test.rb
index 1597471c..5b28c1b2 100644
--- a/test/controllers/account/transfers_controller_test.rb
+++ b/test/controllers/account/transfers_controller_test.rb
@@ -22,6 +22,7 @@ class Account::TransfersControllerTest < ActionDispatch::IntegrationTest
name: "Test Transfer"
}
}
+ assert_enqueued_with job: AccountSyncJob
end
end