From 99932e0aaf062c68d28e99a8eec2b9713ceddd69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 16 Mar 2025 03:38:20 +0100 Subject: [PATCH] Simplify navigation in budget executions tests We're already testing the navigation in one test, and in some of these tests we were checking, for instance, that the title of an investment is present after a click, but since it is also present before that click, that could lead to the test finishing before the request does. --- spec/system/budgets/executions_spec.rb | 35 ++++++-------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/spec/system/budgets/executions_spec.rb b/spec/system/budgets/executions_spec.rb index 253691969..d6e663cb6 100644 --- a/spec/system/budgets/executions_spec.rb +++ b/spec/system/budgets/executions_spec.rb @@ -29,8 +29,6 @@ describe "Executions" do visit budget_path(budget) click_link "See results" - expect(page).to have_link("Milestones") - click_link "Milestones" expect(page).to have_content(investment1.title) @@ -60,10 +58,7 @@ describe "Executions" do scenario "Show message when there are no winning investments with the selected status" do create(:milestone_status, name: I18n.t("seeds.budgets.statuses.executed")) - visit budget_path(budget) - - click_link "See results" - click_link "Milestones" + visit budget_executions_path(budget) expect(page).to have_content("No winner investments in this state") @@ -83,10 +78,7 @@ describe "Executions" do scenario "renders default image if no milestone nor investment images are available" do create(:milestone, milestoneable: investment4) - visit budget_path(budget) - - click_link "See results" - click_link "Milestones" + visit budget_executions_path(budget) expect(page).to have_content investment4.title expect(page).to have_css "img[alt='#{investment4.title}']" @@ -106,10 +98,7 @@ describe "Executions" do publication_date: Date.yesterday, status: status2) - visit budget_path(budget) - - click_link "See results" - click_link "Milestones" + visit budget_executions_path(budget) expect(page).to have_content("All (2)") expect(page).to have_content("#{status1.name} (1)") @@ -121,10 +110,7 @@ describe "Executions" do create(:milestone, milestoneable: investment2, status: status2) create(:milestone_status, name: I18n.t("seeds.budgets.statuses.executing_project")) - visit budget_path(budget) - - click_link "See results" - click_link "Milestones" + visit budget_executions_path(budget) expect(page).to have_content(investment1.title) expect(page).to have_content(investment2.title) @@ -157,9 +143,7 @@ describe "Executions" do publication_date: Date.yesterday, status: status2) - visit budget_path(budget) - click_link "See results" - click_link "Milestones" + visit budget_executions_path(budget) select "Studying the project (0)", from: "Project's current state" click_button "Filter" @@ -181,9 +165,7 @@ describe "Executions" do publication_date: Date.tomorrow, status: status2) - visit budget_path(budget) - click_link "See results" - click_link "Milestones" + visit budget_executions_path(budget) select "Studying the project (1)", from: "Project's current state" click_button "Filter" @@ -207,10 +189,7 @@ describe "Executions" do investment3.milestone_tag_list.add("tag2") investment3.save! - visit budget_path(budget) - - click_link "See results" - click_link "Milestones" + visit budget_executions_path(budget) expect(page).to have_content(investment1.title) expect(page).to have_content(investment2.title)