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
Boxiang Sun
gitlab-ce
Commits
e24cb79f
Commit
e24cb79f
authored
Apr 11, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add constraints to help#show route parameters
parent
1e27b68b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
35 deletions
+20
-35
config/routes.rb
config/routes.rb
+1
-1
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+19
-34
No files found.
config/routes.rb
View file @
e24cb79f
...
@@ -39,7 +39,7 @@ Gitlab::Application.routes.draw do
...
@@ -39,7 +39,7 @@ Gitlab::Application.routes.draw do
# Help
# Help
get
'help'
=>
'help#index'
get
'help'
=>
'help#index'
get
'help/:category/:file'
=>
'help#show'
,
as: :help_page
get
'help/:category/:file'
=>
'help#show'
,
as: :help_page
,
constraints:
{
category:
/[^\.]+/
,
file:
/[^\.]+/
}
get
'help/shortcuts'
get
'help/shortcuts'
get
'help/ui'
=>
'help#ui'
get
'help/ui'
=>
'help#ui'
...
...
spec/routing/routing_spec.rb
View file @
e24cb79f
...
@@ -65,49 +65,34 @@ describe SnippetsController, "routing" do
...
@@ -65,49 +65,34 @@ describe SnippetsController, "routing" do
end
end
# help GET /help(.:format) help#index
# help GET /help(.:format) help#index
# help_permissions GET /help/permissions(.:format) help#permissions
# help_page GET /help/:category/:file(.:format) help#show {:category=>/[^\.]+/, :file=>/[^\.]+/}
# help_workflow GET /help/workflow(.:format) help#workflow
# help_shortcuts GET /help/shortcuts(.:format) help#shortcuts
# help_api GET /help/api(.:format) help#api
# help_ui GET /help/ui(.:format) help#ui
# help_web_hooks GET /help/web_hooks(.:format) help#web_hooks
# help_system_hooks GET /help/system_hooks(.:format) help#system_hooks
# help_markdown GET /help/markdown(.:format) help#markdown
# help_ssh GET /help/ssh(.:format) help#ssh
# help_raketasks GET /help/raketasks(.:format) help#raketasks
describe
HelpController
,
"routing"
do
describe
HelpController
,
"routing"
do
it
"to #index"
do
it
"to #index"
do
expect
(
get
(
"/help"
)).
to
route_to
(
'help#index'
)
expect
(
get
(
"/help"
)).
to
route_to
(
'help#index'
)
end
end
it
"to #permissions"
do
it
'to #show'
do
expect
(
get
(
"/help/permissions/permissions"
)).
to
route_to
(
'help#show'
,
category:
"permissions"
,
file:
"permissions"
)
path
=
'/help/markdown/markdown.md'
end
expect
(
get
(
path
)).
to
route_to
(
'help#show'
,
category:
'markdown'
,
it
"to #workflow"
do
file:
'markdown'
,
expect
(
get
(
"/help/workflow/README"
)).
to
route_to
(
'help#show'
,
category:
"workflow"
,
file:
"README"
)
format:
'md'
)
end
it
"to #api"
do
expect
(
get
(
"/help/api/README"
)).
to
route_to
(
'help#show'
,
category:
"api"
,
file:
"README"
)
end
it
"to #web_hooks"
do
expect
(
get
(
"/help/web_hooks/web_hooks"
)).
to
route_to
(
'help#show'
,
category:
"web_hooks"
,
file:
"web_hooks"
)
end
it
"to #system_hooks"
do
expect
(
get
(
"/help/system_hooks/system_hooks"
)).
to
route_to
(
'help#show'
,
category:
"system_hooks"
,
file:
"system_hooks"
)
end
it
"to #markdown"
do
path
=
'/help/workflow/protected_branches/protected_branches1.png'
expect
(
get
(
"/help/markdown/markdown"
)).
to
route_to
(
'help#show'
,
category:
"markdown"
,
file:
"markdown"
)
expect
(
get
(
path
)).
to
route_to
(
'help#show'
,
category:
'workflow/protected_branches'
,
file:
'protected_branches1'
,
format:
'png'
)
end
end
it
"to #ssh"
do
it
'to #shortcuts'
do
expect
(
get
(
"/help/ssh/README"
)).
to
route_to
(
'help#show'
,
category:
"ssh"
,
file:
"README"
)
expect
(
get
(
'/help/shortcuts'
)).
to
route_to
(
'help#shortcuts'
)
end
end
it
"to #raketasks"
do
it
'to #ui'
do
expect
(
get
(
"/help/raketasks/README"
)).
to
route_to
(
'help#show'
,
category:
"raketasks"
,
file:
"README"
)
expect
(
get
(
'/help/ui'
)).
to
route_to
(
'help#ui'
)
end
end
end
end
...
...
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