Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
ee1b89ae
Commit
ee1b89ae
authored
Oct 20, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport EE changes to group routes
parent
090aefdc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
44 deletions
+38
-44
config/routes/group.rb
config/routes/group.rb
+35
-35
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+3
-9
No files found.
config/routes/group.rb
View file @
ee1b89ae
...
...
@@ -4,7 +4,19 @@ resources :groups, only: [:index, :new, :create] do
post
:preview_markdown
end
scope
(
path:
'groups/*group_id'
,
constraints
(
GroupUrlConstrainer
.
new
)
do
scope
(
path:
'groups/*id'
,
controller: :groups
,
constraints:
{
id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
,
format:
/(html|json|atom)/
})
do
get
:edit
,
as: :edit_group
get
:issues
,
as: :issues_group
get
:merge_requests
,
as: :merge_requests_group
get
:projects
,
as: :projects_group
get
:activity
,
as: :activity_group
get
'/'
,
action: :show
,
as: :group_canonical
end
scope
(
path:
'groups/*group_id'
,
module: :groups
,
as: :group
,
constraints:
{
group_id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
})
do
...
...
@@ -35,20 +47,8 @@ scope(path: 'groups/*group_id',
resources
:children
,
only:
[
:index
]
end
end
scope
(
path:
'groups/*id'
,
controller: :groups
,
constraints:
{
id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
,
format:
/(html|json|atom)/
})
do
get
:edit
,
as: :edit_group
get
:issues
,
as: :issues_group
get
:merge_requests
,
as: :merge_requests_group
get
:projects
,
as: :projects_group
get
:activity
,
as: :activity_group
get
'/'
,
action: :show
,
as: :group_canonical
end
end
constraints
(
GroupUrlConstrainer
.
new
)
do
scope
(
path:
'*id'
,
as: :group
,
constraints:
{
id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
,
format:
/(html|json|atom)/
},
...
...
spec/routing/routing_spec.rb
View file @
ee1b89ae
...
...
@@ -285,17 +285,15 @@ end
describe
"Groups"
,
"routing"
do
let
(
:name
)
{
'complex.group-namegit'
}
before
do
allow_any_instance_of
(
GroupUrlConstrainer
).
to
receive
(
:matches?
).
and_return
(
true
)
end
let!
(
:group
)
{
create
(
:group
,
name:
name
)
}
it
"to #show"
do
expect
(
get
(
"/groups/
#{
name
}
"
)).
to
route_to
(
'groups#show'
,
id:
name
)
end
it
"also supports nested groups"
do
expect
(
get
(
"/
#{
name
}
/
#{
name
}
"
)).
to
route_to
(
'groups#show'
,
id:
"
#{
name
}
/
#{
name
}
"
)
nested_group
=
create
(
:group
,
parent:
group
)
expect
(
get
(
"/
#{
name
}
/
#{
nested_group
.
name
}
"
)).
to
route_to
(
'groups#show'
,
id:
"
#{
name
}
/
#{
nested_group
.
name
}
"
)
end
it
"also display group#show on the short path"
do
...
...
@@ -313,10 +311,6 @@ describe "Groups", "routing" do
it
"to #members"
do
expect
(
get
(
"/groups/
#{
name
}
/group_members"
)).
to
route_to
(
'groups/group_members#index'
,
group_id:
name
)
end
it
"also display group#show with slash in the path"
do
expect
(
get
(
'/group/subgroup'
)).
to
route_to
(
'groups#show'
,
id:
'group/subgroup'
)
end
end
describe
HealthCheckController
,
'routing'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment