Skip to content

Commit

Permalink
fixup! URL Perms: Reports, widgets controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Dec 19, 2023
1 parent 8630adc commit 6405f7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
12 changes: 2 additions & 10 deletions config/routes/redirects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,8 @@

get '/request/:id(/*suffix)',
constraints: { id: /\d+/, suffix: %r(report/new) },
to: redirect(
-> (params, request) do
redirect_to_info_request_url_title_path(request: request, **params)
end
)
to: info_request_redirect

get '/request/:id(/*suffix)',
constraints: { id: /\d+/, suffix: %r(widget(/new)?) },
to: redirect(
-> (params, request) do
redirect_to_info_request_url_title_path(request: request, **params)
end
)
to: info_request_redirect
9 changes: 9 additions & 0 deletions spec/routing/redirects_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
it 'routes numerical request member routes to URL title member routes' do
get('/request/105/followups/new')
expect(response).to redirect_to('/request/the_cost_of_boring/followups/new')

get('/request/105/report/new')
expect(response).to redirect_to('/request/the_cost_of_boring/report/new')

get('/request/105/widget')
expect(response).to redirect_to('/request/the_cost_of_boring/widget')

get('/request/105/widget/new')
expect(response).to redirect_to('/request/the_cost_of_boring/widget/new')
end

it 'routes numerical request attachment routes to URL title attachment routes' do
Expand Down

0 comments on commit 6405f7a

Please sign in to comment.