BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
30c73d2d
Commit
30c73d2d
authored
Jan 27, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add controller test for merge requests pipelines API
parent
6b3f52b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
pipeline_serializer.rb
app/serializers/pipeline_serializer.rb
+2
-1
merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+32
-1
No files found.
app/serializers/pipeline_serializer.rb
View file @
30c73d2d
class
PipelineSerializer
<
BaseSerializer
entity
PipelineEntity
class
InvalidResourceError
<
StandardError
;
end
include
API
::
Helpers
::
Pagination
Struct
.
new
(
'Pagination'
,
:request
,
:response
)
entity
PipelineEntity
def
represent
(
resource
,
opts
=
{})
if
paginated?
raise
InvalidResourceError
unless
resource
.
respond_to?
(
:page
)
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
30c73d2d
...
...
@@ -668,7 +668,38 @@ describe Projects::MergeRequestsController do
end
describe
'GET pipelines'
do
it_behaves_like
"loads labels"
,
:pipelines
before
do
create
(
:ci_pipeline
,
project:
merge_request
.
source_project
,
ref:
merge_request
.
source_branch
,
sha:
merge_request
.
diff_head_sha
)
end
context
'when using HTML format'
do
it_behaves_like
"loads labels"
,
:pipelines
end
context
'when using JSON format'
do
before
do
get
:pipelines
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
format: :json
end
let
(
:json_response
)
{
JSON
.
parse
(
response
.
body
)
}
it
'responds with a rendered HTML partial'
do
expect
(
response
)
.
to
render_template
(
'projects/merge_requests/show/_pipelines'
)
expect
(
json_response
).
to
have_key
'html'
end
it
'responds with serialized pipelines'
do
expect
(
json_response
).
to
have_key
'pipelines'
expect
(
json_response
[
'pipelines'
]).
not_to
be_empty
end
end
end
describe
'GET conflicts'
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