The personal finance app for everyone
Fix: Fix unalble to reject automatched transfers (#2102)
Tony Vincentf23569717825
diff --git a/app/controllers/transfers_controller.rb b/app/controllers/transfers_controller.rbindex c20ccacc..895dcfa2 100644--- a/app/controllers/transfers_controller.rb+++ b/app/controllers/transfers_controller.rb@@ -38,7 +38,7 @@ class TransfersController < ApplicationControllerdef updateTransfer.transaction doupdate_transfer_status- update_transfer_details+ update_transfer_details unless transfer_update_params[:status] == "rejected"endrespond_to do |format|diff --git a/test/controllers/transfers_controller_test.rb b/test/controllers/transfers_controller_test.rbindex 3350b2c6..9959f45b 100644--- a/test/controllers/transfers_controller_test.rb+++ b/test/controllers/transfers_controller_test.rb@@ -41,4 +41,24 @@ class TransfersControllerTest < ActionDispatch::IntegrationTestassert_equal "Transfer updated", flash[:notice]assert_equal "Test notes", transfer.reload.notesend++ 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+ endend