From f5c1cfbf8c886063bfce3ab26fb8e5adebe02523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 15 Mar 2021 14:16:25 +0100 Subject: [PATCH] Fix group investments filters links They were pointing to the budget page instead of the budget group page, which made navigation weird. --- app/views/budgets/groups/show.html.erb | 4 ++-- spec/system/budgets/groups_spec.rb | 19 +++++++++++++++++++ spec/system/budgets/investments_spec.rb | 3 --- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/app/views/budgets/groups/show.html.erb b/app/views/budgets/groups/show.html.erb index b7565a265..d8741f6eb 100644 --- a/app/views/budgets/groups/show.html.erb +++ b/app/views/budgets/groups/show.html.erb @@ -55,7 +55,7 @@
<%= link_to t("budgets.groups.show.unfeasible"), - budget_path(@budget, filter: "unfeasible") %> + budget_group_path(@budget, @group, filter: "unfeasible") %>
@@ -66,7 +66,7 @@
<%= link_to t("budgets.groups.show.unselected"), - budget_path(@budget, filter: "unselected") %> + budget_group_path(@budget, @group, filter: "unselected") %>
diff --git a/spec/system/budgets/groups_spec.rb b/spec/system/budgets/groups_spec.rb index c8f68b0d8..df2eb6c8e 100644 --- a/spec/system/budgets/groups_spec.rb +++ b/spec/system/budgets/groups_spec.rb @@ -49,5 +49,24 @@ describe "Budget Groups" do expect(first_heading.name).to appear_before(last_heading.name) end + + scenario "Links to investment filters", :js do + create(:budget_heading, group: group, name: "Southwest") + budget.update!(phase: "finished") + + visit budget_group_path(budget, group) + + click_link "See unfeasible investments" + + expect(page).to have_css "h3", exact_text: "Unfeasible investments" + expect(page).to have_link "Southwest" + expect(page).not_to have_link "See unfeasible investments" + + click_link "See investments not selected for balloting phase" + + expect(page).to have_css "h3", exact_text: "Investments not selected for balloting phase" + expect(page).to have_link "Southwest" + expect(page).not_to have_link "See investments not selected for balloting phase unfeasible investments" + end end end diff --git a/spec/system/budgets/investments_spec.rb b/spec/system/budgets/investments_spec.rb index 11a7707fd..73555d56a 100644 --- a/spec/system/budgets/investments_spec.rb +++ b/spec/system/budgets/investments_spec.rb @@ -1325,10 +1325,7 @@ describe "Budget Investments" do expect(page).to have_css("#budget_heading_#{heading_1.id}.is-active") expect(page).to have_css("#budget_heading_#{heading_2.id}") - visit budget_group_path(budget, group) - click_link "See unfeasible investments" - click_link "Health" within("#headings") do expect(page).to have_css("#budget_heading_#{heading_1.id}")