The personal finance app for everyone (by everyone)
Ruby
Stop holding drawer system tests racing the toast (#4503)
Bhargav Mehtae86b5f347fc5
diff --git a/test/controllers/holdings_controller_test.rb b/test/controllers/holdings_controller_test.rbindex 9faa65fa29..5b295cd7f1 100644--- a/test/controllers/holdings_controller_test.rb+++ b/test/controllers/holdings_controller_test.rb@@ -222,6 +222,7 @@ class HoldingsControllerTest < ActionDispatch::IntegrationTest# Redirects to account page holdings tab to refresh listassert_redirected_to account_path(@holding.account, tab: "holdings")+ assert_equal I18n.t("holdings.unlock_cost_basis.success"), flash[:notice]@holding.reload# Then: lock is removed but cost_basis and source remain@@ -230,6 +231,17 @@ class HoldingsControllerTest < ActionDispatch::IntegrationTestassert_equal "manual", @holding.cost_basis_sourceend+ test "reset_security restores the provider security and confirms it" do+ @holding.account.update!(plaid_account: plaid_accounts(:one))+ @holding.update!(security: securities(:msft), provider_security: securities(:aapl), security_locked: true)++ post reset_security_holding_path(@holding)++ assert_redirected_to account_path(@holding.account, tab: "holdings")+ assert_equal I18n.t("holdings.reset_security.success"), flash[:notice]+ assert_equal securities(:aapl), @holding.reload.security+ end+test "remap_security brings offline security back online" do# Given: the target security is marked offline (e.g. created by a failed QIF import)msft = securities(:msft)diff --git a/test/system/holding_drawer_actions_test.rb b/test/system/holding_drawer_actions_test.rbindex 773c1d2d5b..ba63918446 100644--- a/test/system/holding_drawer_actions_test.rb+++ b/test/system/holding_drawer_actions_test.rb@@ -26,7 +26,7 @@ class HoldingDrawerActionsTest < ApplicationSystemTestCaseclick_on I18n.t("holdings.show.unlock_cost_basis")within("#confirm-dialog") { find("button[value=confirm]").click }- assert_text I18n.t("holdings.unlock_cost_basis.success")+ assert_current_path account_path(@holding.account, tab: "holdings")assert_not @holding.reload.cost_basis_locked?end@@ -49,7 +49,7 @@ class HoldingDrawerActionsTest < ApplicationSystemTestCaseclick_on I18n.t("holdings.show.reset_to_provider")within("#confirm-dialog") { find("button[value=confirm]").click }- assert_text I18n.t("holdings.reset_security.success")+ assert_current_path account_path(@holding.account, tab: "holdings")assert_equal securities(:aapl), @holding.reload.securityendend