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
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
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
app/serializers/pipeline_serializer.rb
app/serializers/pipeline_serializer.rb
+2
-1
spec/controllers/projects/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