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
39f834b6
Commit
39f834b6
authored
Mar 27, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add routing specs for environment folders
parent
237517c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
spec/routing/environments_spec.rb
spec/routing/environments_spec.rb
+49
-0
No files found.
spec/routing/environments_spec.rb
0 → 100644
View file @
39f834b6
require
'spec_helper'
describe
Projects
::
EnvironmentsController
,
:routing
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:environment
)
do
create
(
:environment
,
project:
project
,
name:
'staging-1.0/review'
)
end
let
(
:environments_route
)
do
"
#{
project
.
namespace
.
name
}
/
#{
project
.
name
}
/environments/"
end
describe
'routing environment folders'
do
context
'when using JSON format'
do
it
'correctly matches environment name and JSON format'
do
expect
(
get_folder
(
'staging-1.0.json'
))
.
to
route_to
(
*
folder_action
(
id:
'staging-1.0'
,
format:
'json'
))
end
end
context
'when using HTML format'
do
it
'correctly matches environment name and HTML format'
do
expect
(
get_folder
(
'staging-1.0.html'
))
.
to
route_to
(
*
folder_action
(
id:
'staging-1.0'
,
format:
'html'
))
end
end
context
'when using implicit format'
do
it
'correctly matches environment name'
do
expect
(
get_folder
(
'staging-1.0'
))
.
to
route_to
(
*
folder_action
(
id:
'staging-1.0'
))
end
end
end
def
get_folder
(
folder
)
get
(
"
#{
project
.
namespace
.
name
}
/
#{
project
.
name
}
/"
\
"environments/folders/
#{
folder
}
"
)
end
def
folder_action
(
**
opts
)
options
=
{
namespace_id:
project
.
namespace
.
name
,
project_id:
project
.
name
}
[
'projects/environments#folder'
,
options
.
merge
(
opts
)]
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