From 0ce2b611e4f4c96931be5d4ebea1533671f5deb4 Mon Sep 17 00:00:00 2001 From: NicoleSo13 <128817593+NicoleSo13@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:29:37 +0200 Subject: [PATCH] Redirect asamblea clima inscriptions (#449) * Redirect asamblea clima inscriptions * Remove useless route * Rework test to make it more stable --------- Co-authored-by: Oliver Valls <199462+tramuntanal@users.noreply.github.com> --- lib/middlewares/redirect_middleware.rb | 2 ++ spec/system/redirect_middleware_spec.rb | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/middlewares/redirect_middleware.rb b/lib/middlewares/redirect_middleware.rb index ff295259..e0107cae 100644 --- a/lib/middlewares/redirect_middleware.rb +++ b/lib/middlewares/redirect_middleware.rb @@ -12,6 +12,8 @@ def call(env) [301, { "Location" => request.url.sub("/futur-europa", "/processes/FuturEuropa") }, []] elsif request.path.starts_with?("/participacooperacio") [301, { "Location" => request.url.sub("/participacooperacio", "/processes/pladirectorcooperacio") }, []] + elsif request.path.starts_with?("/assembleaclima/inscripcions") + [301, { "Location" => request.url.sub("/assembleaclima/inscripcions", "/processes/assembleaclima/f/3825") }, []] elsif request.path.starts_with?("/assembleaclima") [301, { "Location" => request.url.sub("/assembleaclima", "/processes/assembleaclima") }, []] else diff --git a/spec/system/redirect_middleware_spec.rb b/spec/system/redirect_middleware_spec.rb index d95b281a..d74caf19 100644 --- a/spec/system/redirect_middleware_spec.rb +++ b/spec/system/redirect_middleware_spec.rb @@ -39,4 +39,22 @@ expect(page).to have_content(title_ca) end end + + describe "Assemblea clima inscripcions" do + let(:title_ca) { "Assemblea clima inscripcions" } + let(:slug) { "assembleaclima" } + let!(:component) do + create :component, + id: 3825, + manifest_name: :meetings, + published_at: Time.zone.now, + participatory_space: process + end + + it "redirects to registrations when /assembleaclima/inscripcions is visited" do + visit "/assembleaclima/inscripcions" + + expect(page).to have_current_path("/processes/assembleaclima/f/3825") + end + end end