From 135e154fe3a044214e7d138c4bb02e145c3807b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 15 Mar 2021 14:24:30 +0100 Subject: [PATCH] Fix "go back" link in budget group and investments Even if we usually only access these pages for the current budget, that might not always be the case, and now that we've unified budget landing pages, there's no point in them pointing to the index anymore. --- app/views/budgets/groups/show.html.erb | 2 +- app/views/budgets/investments/_header.html.erb | 2 +- spec/system/budgets/groups_spec.rb | 8 ++++++++ spec/system/budgets/investments_spec.rb | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/views/budgets/groups/show.html.erb b/app/views/budgets/groups/show.html.erb index 81a797797..aa1786f6b 100644 --- a/app/views/budgets/groups/show.html.erb +++ b/app/views/budgets/groups/show.html.erb @@ -5,7 +5,7 @@
- <%= back_link_to budgets_path %> + <%= back_link_to budget_path(@budget) %>

<%= t("budgets.groups.show.title") %>

diff --git a/app/views/budgets/investments/_header.html.erb b/app/views/budgets/investments/_header.html.erb index 0b18c3e1f..36fd6c02b 100644 --- a/app/views/budgets/investments/_header.html.erb +++ b/app/views/budgets/investments/_header.html.erb @@ -4,7 +4,7 @@
- <%= back_link_to budgets_path %> + <%= back_link_to budget_path(@budget) %> <% if can? :show, @ballot %> <%= link_to t("budgets.investments.header.check_ballot"), diff --git a/spec/system/budgets/groups_spec.rb b/spec/system/budgets/groups_spec.rb index df2eb6c8e..9b26bbd13 100644 --- a/spec/system/budgets/groups_spec.rb +++ b/spec/system/budgets/groups_spec.rb @@ -68,5 +68,13 @@ describe "Budget Groups" do expect(page).to have_link "Southwest" expect(page).not_to have_link "See investments not selected for balloting phase unfeasible investments" end + + scenario "Back link", :js do + visit budget_group_path(budget, group) + + click_link "Go back" + + expect(page).to have_current_path budget_path(budget) + end end end diff --git a/spec/system/budgets/investments_spec.rb b/spec/system/budgets/investments_spec.rb index 08cdad36f..65f463bd6 100644 --- a/spec/system/budgets/investments_spec.rb +++ b/spec/system/budgets/investments_spec.rb @@ -88,6 +88,10 @@ describe "Budget Investments" do expect(page).not_to have_content(unfeasible_investment.title) end end + + click_link "Go back" + + expect(page).to have_current_path budget_path(budget) end scenario "Index view mode" do