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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
88b03bb5
Commit
88b03bb5
authored
Oct 10, 2016
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename method in test
parent
58368fbc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
21 deletions
+31
-21
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+23
-18
config/routes.rb
config/routes.rb
+5
-0
spec/models/environment_spec.rb
spec/models/environment_spec.rb
+3
-3
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
88b03bb5
...
...
@@ -404,7 +404,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def
ci_environments_status
render
json:
@merge_request
.
environments
.
map
do
|
environment
|
environments
=
begin
@merge_request
.
environments
.
map
do
|
environment
|
next
unless
can?
(
current_user
,
:read_environment
,
environment
)
deployment
=
environment
.
first_deployment_for
(
@merge_request
.
diff_head_commit
)
...
...
@@ -429,6 +431,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
.
compact
end
render
json:
environments
end
protected
def
selected_target_project
...
...
config/routes.rb
View file @
88b03bb5
...
...
@@ -83,4 +83,9 @@ Rails.application.routes.draw do
draw
:group
draw
:user
draw
:project
# Get all keys of user
get
':username.keys'
=>
'profiles/keys#get_keys'
,
constraints:
{
username:
/.*/
}
root
to:
"root#index"
end
spec/models/environment_spec.rb
View file @
88b03bb5
...
...
@@ -64,7 +64,7 @@ describe Environment, models: true do
end
end
describe
'#
deployment_id
_for'
do
describe
'#
first_deployment
_for'
do
let
(
:project
)
{
create
(
:project
)
}
let!
(
:environment
)
{
create
(
:environment
,
project:
project
)
}
let!
(
:deployment
)
{
create
(
:deployment
,
environment:
environment
,
ref:
commit
.
parent
.
id
)
}
...
...
@@ -73,11 +73,11 @@ describe Environment, models: true do
let
(
:commit
)
{
project
.
commit
.
parent
}
it
'returns deployment id for the environment'
do
expect
(
environment
.
deployment_id_for
(
commit
)).
to
eq
deployment1
.
id
expect
(
environment
.
first_deployment_for
(
commit
)).
to
eq
deployment1
end
it
'return nil when no deployment is found'
do
expect
(
environment
.
deployment_id
_for
(
head_commit
)).
to
eq
nil
expect
(
environment
.
first_deployment
_for
(
head_commit
)).
to
eq
nil
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