From 0ccfac76adda903702a6a266dc04c01cdd48bc26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?= <15726+Senen@users.noreply.github.com> Date: Wed, 13 Jul 2022 13:25:22 +0200 Subject: [PATCH] Remove Processes link on help page when legislation is disabled --- app/views/pages/help/_menu.html.erb | 12 +++++++----- spec/system/help_page_spec.rb | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/views/pages/help/_menu.html.erb b/app/views/pages/help/_menu.html.erb index 5391b3c82..61cb44687 100644 --- a/app/views/pages/help/_menu.html.erb +++ b/app/views/pages/help/_menu.html.erb @@ -29,11 +29,13 @@ class: "button hollow expanded" ] if feature?(:polls) ), - [ - t("pages.help.menu.processes"), - "#processes", - class: "button hollow expanded" - ], + ( + [ + t("pages.help.menu.processes"), + "#processes", + class: "button hollow expanded" + ] if feature?(:legislation) + ), [ t("pages.help.menu.other"), "#other", diff --git a/spec/system/help_page_spec.rb b/spec/system/help_page_spec.rb index 5b1a365a7..a03dcfe3a 100644 --- a/spec/system/help_page_spec.rb +++ b/spec/system/help_page_spec.rb @@ -56,4 +56,22 @@ describe "Help page" do expect(page).not_to have_link "Sustainable Development Goals help" end + + scenario "renders the legislation section link when the process is enabled" do + Setting["feature.help_page"] = true + Setting["process.legislation"] = true + + visit page_path("help") + + expect(page).to have_link "Processes", href: "#processes" + end + + scenario "does not render the legislation section link when the process is disabled" do + Setting["feature.help_page"] = true + Setting["process.legislation"] = nil + + visit page_path("help") + + expect(page).not_to have_link "Processes" + end end