Fix 404 when group path has dot in the name
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
59fd455577
commit
c48f715318
2 changed files with 10 additions and 1 deletions
|
@ -1,7 +1,10 @@
|
|||
require 'constraints/group_url_constrainer'
|
||||
|
||||
constraints(GroupUrlConstrainer.new) do
|
||||
scope(path: ':id', as: :group, controller: :groups) do
|
||||
scope(path: ':id',
|
||||
as: :group,
|
||||
constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ },
|
||||
controller: :groups) do
|
||||
get '/', action: :show
|
||||
patch '/', action: :update
|
||||
put '/', action: :update
|
||||
|
|
|
@ -270,6 +270,12 @@ describe "Groups", "routing" do
|
|||
|
||||
expect(get('/1')).to route_to('groups#show', id: '1')
|
||||
end
|
||||
|
||||
it "also display group#show with dot in the path" do
|
||||
allow(Group).to receive(:find_by_path).and_return(true)
|
||||
|
||||
expect(get('/group.with.dot')).to route_to('groups#show', id: 'group.with.dot')
|
||||
end
|
||||
end
|
||||
|
||||
describe HealthCheckController, 'routing' do
|
||||
|
|
Loading…
Reference in a new issue