Commit c48f7153 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix 404 when group path has dot in the name

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 59fd4555
require 'constraints/group_url_constrainer' require 'constraints/group_url_constrainer'
constraints(GroupUrlConstrainer.new) do 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 get '/', action: :show
patch '/', action: :update patch '/', action: :update
put '/', action: :update put '/', action: :update
......
...@@ -270,6 +270,12 @@ describe "Groups", "routing" do ...@@ -270,6 +270,12 @@ describe "Groups", "routing" do
expect(get('/1')).to route_to('groups#show', id: '1') expect(get('/1')).to route_to('groups#show', id: '1')
end 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 end
describe HealthCheckController, 'routing' do describe HealthCheckController, 'routing' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment