diff options
author | Rémy Coutable <remy@rymai.me> | 2016-11-21 11:48:01 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-11-21 11:48:01 +0000 |
commit | 220c258c68c8f2e4f0315153c443c036c3ace90c (patch) | |
tree | c23d0180432d0189c37b6be1a91106170b393c40 /spec/routing | |
parent | c99522f21eed933f6a6b7214ea659e3ab13ef188 (diff) | |
parent | beb638ca0379472eb15f840249321cdaca7bf5be (diff) | |
download | gitlab-ce-220c258c68c8f2e4f0315153c443c036c3ace90c.tar.gz |
Merge branch 'dz-fix-group-name-dot' into 'master'
Add constraints to group id in routing
To prevent 404 when visit page like https://gitlab.com/groups/group.with.dot/activity
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/24622
See merge request !7614
Diffstat (limited to 'spec/routing')
-rw-r--r-- | spec/routing/routing_spec.rb | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index 61dca5d5a62..7aba4f08088 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -261,20 +261,28 @@ describe "Authentication", "routing" do end describe "Groups", "routing" do + let(:name) { 'complex.group-name' } + it "to #show" do - expect(get("/groups/1")).to route_to('groups#show', id: '1') + expect(get("/groups/#{name}")).to route_to('groups#show', id: name) end it "also display group#show on the short path" do allow(Group).to receive(:find_by).and_return(true) - expect(get('/1')).to route_to('groups#show', id: '1') + expect(get("/#{name}")).to route_to('groups#show', id: name) end - it "also display group#show with dot in the path" do - allow(Group).to receive(:find_by).and_return(true) + it "to #activity" do + expect(get("/groups/#{name}/activity")).to route_to('groups#activity', id: name) + end + + it "to #issues" do + expect(get("/groups/#{name}/issues")).to route_to('groups#issues', id: name) + end - expect(get('/group.with.dot')).to route_to('groups#show', id: 'group.with.dot') + it "to #members" do + expect(get("/groups/#{name}/group_members")).to route_to('groups/group_members#index', group_id: name) end end |