1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00

Fix: Fix unalble to reject automatched transfers (#2102)

Co-authored-by: Zach Gollwitzer <zach@maybe.co>
This commit is contained in:
Tony Vincent 2025-04-14 15:05:25 +02:00 committed by GitHub
parent e517127062
commit f235697178
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View file

@ -38,7 +38,7 @@ class TransfersController < ApplicationController
def update
Transfer.transaction do
update_transfer_status
update_transfer_details
update_transfer_details unless transfer_update_params[:status] == "rejected"
end
respond_to do |format|

View file

@ -41,4 +41,24 @@ class TransfersControllerTest < ActionDispatch::IntegrationTest
assert_equal "Transfer updated", flash[:notice]
assert_equal "Test notes", transfer.reload.notes
end
test "handles rejection without FrozenError" do
transfer = transfers(:one)
assert_difference "Transfer.count", -1 do
patch transfer_url(transfer), params: {
transfer: {
status: "rejected"
}
}
end
assert_redirected_to transactions_url
assert_equal "Transfer updated", flash[:notice]
# Verify the transfer was actually destroyed
assert_raises(ActiveRecord::RecordNotFound) do
transfer.reload
end
end
end