From 35b23da4422d542e995648f7d4be712717b267c9 Mon Sep 17 00:00:00 2001 From: dripsmvcp <138900956+dripsmvcp@users.noreply.github.com> Date: Fri, 5 Jun 2026 19:11:37 +0900 Subject: [PATCH] test(import): scope leak assertions to account select (#2194 CodeRabbit) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CodeRabbit nitpick: assert_match on response.body could pass/fail on text outside the account dropdown (sidebar, breadcrumb, error message, etc.) and gave false confidence in the refute_match exclusions. Switch to assert_select 'select[name="import[account_id]"] option', text: … so the assertions only see the option nodes the leak test actually cares about. --- test/controllers/import/uploads_controller_test.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/controllers/import/uploads_controller_test.rb b/test/controllers/import/uploads_controller_test.rb index ded4f2e4f..1836ac95d 100644 --- a/test/controllers/import/uploads_controller_test.rb +++ b/test/controllers/import/uploads_controller_test.rb @@ -41,14 +41,10 @@ class Import::UploadsControllerTest < ActionDispatch::IntegrationTest get import_upload_url(@import) assert_response :success - assert_match "Checking Account", response.body, - "Expected the shared account to appear in the account select" - refute_match "Collectable Account", response.body, - "Account select must not leak unshared assets to a non-owner family member" - refute_match "IOU (personal debt to friend)", response.body, - "Account select must not leak unshared liabilities to a non-owner family member" - refute_match "Plaid Depository Account", response.body, - "Account select must not leak unshared connected accounts to a non-owner family member" + assert_select 'select[name="import[account_id]"] option', text: "Checking Account" + assert_select 'select[name="import[account_id]"] option', text: "Collectable Account", count: 0 + assert_select 'select[name="import[account_id]"] option', text: "IOU (personal debt to friend)", count: 0 + assert_select 'select[name="import[account_id]"] option', text: "Plaid Depository Account", count: 0 end test "invalid csv cannot be uploaded" do