Skip to content

Commit

Permalink
Add redirect for assembleaclima (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramuntanal authored Sep 18, 2023
1 parent 08ca939 commit 7b4c4c1
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 18 deletions.
2 changes: 2 additions & 0 deletions lib/middlewares/redirect_middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
[301, { "Location" => request.url.sub("/assembleaclima", "/processes/assembleaclima") }, []]
else
@app.call(env)
end
Expand Down
18 changes: 0 additions & 18 deletions spec/system/future_europe_spec.rb

This file was deleted.

42 changes: 42 additions & 0 deletions spec/system/redirect_middleware_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# frozen_string_literal: true

require "rails_helper"

describe "Redirect Middleware", type: :system do
let!(:organization) { process.organization }
let!(:process) { create(:participatory_process, slug: slug, title: { ca: title_ca }) }

before do
switch_to_host(organization.host)
end

describe "Futur Europa redirect" do
let(:title_ca) { "El futur d'Europa" }
let(:slug) { "FuturEuropa" }

it "redirects to the process when /futur-europa is visited" do
visit "/futur-europa"
expect(page).to have_content(title_ca)
end
end

describe "Pla director cooperació" do
let(:title_ca) { "Pla director cooperació" }
let(:slug) { "pladirectorcooperacio" }

it "redirects to the process when /participacooperacio is visited" do
visit "/participacooperacio"
expect(page).to have_content(title_ca)
end
end

describe "Assemblea clima" do
let(:title_ca) { "Assemblea clima" }
let(:slug) { "assembleaclima" }

it "redirects to the process when /assembleaclima is visited" do
visit "/assembleaclima"
expect(page).to have_content(title_ca)
end
end
end

0 comments on commit 7b4c4c1

Please sign in to comment.