Check different content in select investments test

Since we were checking something that was already there, if the form
were submitted using an AJAX request (which is the default with Turbo,
although we don't use it yet), there would be a chance that the request
didn't finish before the test does, leading to potential failures in the
next test.

This way we're also checking that the "Filter" button actually does
something when selecting the "Selected" filter.
This commit is contained in:
Javi Martín
2024-10-06 16:06:31 +02:00
parent f72daff71f
commit 1b46afc95c

View File

@@ -1410,6 +1410,8 @@ describe "Admin budget investments", :admin do
scenario "Selecting an investment" do
visit admin_budget_budget_investments_path(budget)
expect(page).to have_content "Unfeasible project"
within("#budget_investment_#{feasible_vf_bi.id}") do
click_button "Select"
expect(page).to have_button "Selected"
@@ -1420,6 +1422,8 @@ describe "Admin budget investments", :admin do
within("#advanced_filters") { check("Selected") }
click_button("Filter")
expect(page).not_to have_content "Unfeasible project"
within("#budget_investment_#{feasible_vf_bi.id}") do
expect(page).not_to have_button "Select"
expect(page).to have_button "Selected"