Skip to content

Commit

Permalink
Redirect asamblea clima inscriptions (#449)
Browse files Browse the repository at this point in the history
* Redirect asamblea clima inscriptions

* Remove useless route

* Rework test to make it more stable

---------

Co-authored-by: Oliver Valls <[email protected]>
  • Loading branch information
NicoleeSo13 and tramuntanal authored Oct 4, 2023
1 parent 60379ba commit 0ce2b61
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 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/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
Expand Down
18 changes: 18 additions & 0 deletions spec/system/redirect_middleware_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0ce2b61

Please sign in to comment.