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
Léo-Paul Géneau
gitlab-ce
Commits
3662f147
Commit
3662f147
authored
May 29, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve specs for pipelines controller
parent
fc3d2141
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
14 deletions
+53
-14
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+53
-14
No files found.
spec/controllers/projects/pipelines_controller_spec.rb
View file @
3662f147
...
...
@@ -17,26 +17,65 @@ describe Projects::PipelinesController do
describe
'GET index.json'
do
before
do
%w(pending running success failed)
.
each_with_index
do
|
status
,
index
|
%w(pending running success failed
canceled
)
.
each_with_index
do
|
status
,
index
|
create_pipeline
(
status
,
project
.
commit
(
"HEAD~
#{
index
}
"
))
end
end
it
'returns JSON with serialized pipelin
es'
,
:request_store
do
queries
=
ActiveRecord
::
QueryRecorder
.
new
do
get_pipelines_index_json
context
'when using persisted stag
es'
,
:request_store
do
before
do
stub_feature_flags
(
ci_pipeline_persisted_stages:
true
)
end
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'pipeline'
)
expect
(
json_response
).
to
include
(
'pipelines'
)
expect
(
json_response
[
'pipelines'
].
count
).
to
eq
4
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
'4'
expect
(
json_response
[
'count'
][
'running'
]).
to
eq
'1'
expect
(
json_response
[
'count'
][
'pending'
]).
to
eq
'1'
expect
(
json_response
[
'count'
][
'finished'
]).
to
eq
'2'
expect
(
queries
.
count
).
to
be
<
30
it
'returns serialized pipelines'
,
:request_store
do
queries
=
ActiveRecord
::
QueryRecorder
.
new
do
get_pipelines_index_json
end
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'pipeline'
)
expect
(
json_response
).
to
include
(
'pipelines'
)
expect
(
json_response
[
'pipelines'
].
count
).
to
eq
5
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
'5'
expect
(
json_response
[
'count'
][
'running'
]).
to
eq
'1'
expect
(
json_response
[
'count'
][
'pending'
]).
to
eq
'1'
expect
(
json_response
[
'count'
][
'finished'
]).
to
eq
'3'
json_response
.
dig
(
'pipelines'
,
0
,
'details'
,
'stages'
).
tap
do
|
stages
|
expect
(
stages
.
count
).
to
eq
3
end
expect
(
queries
.
count
).
to
be
end
end
context
'when using legacy stages'
,
:request_store
do
before
do
stub_feature_flags
(
ci_pipeline_persisted_stages:
false
)
end
it
'returns JSON with serialized pipelines'
,
:request_store
do
queries
=
ActiveRecord
::
QueryRecorder
.
new
do
get_pipelines_index_json
end
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'pipeline'
)
expect
(
json_response
).
to
include
(
'pipelines'
)
expect
(
json_response
[
'pipelines'
].
count
).
to
eq
5
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
'5'
expect
(
json_response
[
'count'
][
'running'
]).
to
eq
'1'
expect
(
json_response
[
'count'
][
'pending'
]).
to
eq
'1'
expect
(
json_response
[
'count'
][
'finished'
]).
to
eq
'3'
json_response
.
dig
(
'pipelines'
,
0
,
'details'
,
'stages'
).
tap
do
|
stages
|
expect
(
stages
.
count
).
to
eq
3
end
expect
(
queries
.
count
).
to
be_within
(
3
).
of
(
30
)
end
end
it
'does not include coverage data for the pipelines'
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