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
16c547a6
Commit
16c547a6
authored
Jun 30, 2020
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes counts from pipeline tabs
parent
bb98addc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
29 deletions
+11
-29
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+0
-6
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+11
-23
No files found.
app/controllers/projects/pipelines_controller.rb
View file @
16c547a6
...
...
@@ -34,9 +34,6 @@ class Projects::PipelinesController < Projects::ApplicationController
.
page
(
params
[
:page
])
.
per
(
30
)
@running_count
=
limited_pipelines_count
(
project
,
'running'
)
@pending_count
=
limited_pipelines_count
(
project
,
'pending'
)
@finished_count
=
limited_pipelines_count
(
project
,
'finished'
)
@pipelines_count
=
limited_pipelines_count
(
project
)
respond_to
do
|
format
|
...
...
@@ -48,9 +45,6 @@ class Projects::PipelinesController < Projects::ApplicationController
pipelines:
serialize_pipelines
,
count:
{
all:
@pipelines_count
,
running:
@running_count
,
pending:
@pending_count
,
finished:
@finished_count
}
}
end
...
...
spec/controllers/projects/pipelines_controller_spec.rb
View file @
16c547a6
...
...
@@ -37,9 +37,6 @@ RSpec.describe Projects::PipelinesController do
expect
(
json_response
).
to
include
(
'pipelines'
)
expect
(
json_response
[
'pipelines'
].
count
).
to
eq
6
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
'6'
expect
(
json_response
[
'count'
][
'running'
]).
to
eq
'2'
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
...
...
@@ -123,12 +120,6 @@ RSpec.describe Projects::PipelinesController do
end
context
'filter by scope'
do
it
'returns matched pipelines'
do
get_pipelines_index_json
(
scope:
'running'
)
check_pipeline_response
(
returned:
2
,
all:
6
,
running:
2
,
pending:
1
,
finished:
3
)
end
context
'scope is branches or tags'
do
before
do
create
(
:ci_pipeline
,
:failed
,
project:
project
,
ref:
'v1.0.0'
,
tag:
true
)
...
...
@@ -140,7 +131,7 @@ RSpec.describe Projects::PipelinesController do
it
'returns matched pipelines'
do
get_pipelines_index_json
(
scope:
'branches'
)
check_pipeline_response
(
returned:
2
,
all:
9
,
running:
2
,
pending:
1
,
finished:
6
)
check_pipeline_response
(
returned:
2
,
all:
9
)
end
end
...
...
@@ -148,7 +139,7 @@ RSpec.describe Projects::PipelinesController do
it
'returns matched pipelines'
do
get_pipelines_index_json
(
scope:
'tags'
)
check_pipeline_response
(
returned:
1
,
all:
9
,
running:
2
,
pending:
1
,
finished:
6
)
check_pipeline_response
(
returned:
1
,
all:
9
)
end
end
end
...
...
@@ -161,7 +152,7 @@ RSpec.describe Projects::PipelinesController do
it
'returns matched pipelines'
do
get_pipelines_index_json
(
username:
user
.
username
)
check_pipeline_response
(
returned:
1
,
all:
1
,
running:
1
,
pending:
0
,
finished:
0
)
check_pipeline_response
(
returned:
1
,
all:
1
)
end
end
...
...
@@ -169,7 +160,7 @@ RSpec.describe Projects::PipelinesController do
it
'returns empty'
do
get_pipelines_index_json
(
username:
'invalid-username'
)
check_pipeline_response
(
returned:
0
,
all:
0
,
running:
0
,
pending:
0
,
finished:
0
)
check_pipeline_response
(
returned:
0
,
all:
0
)
end
end
end
...
...
@@ -181,7 +172,7 @@ RSpec.describe Projects::PipelinesController do
it
'returns matched pipelines'
do
get_pipelines_index_json
(
ref:
'branch-1'
)
check_pipeline_response
(
returned:
1
,
all:
1
,
running:
1
,
pending:
0
,
finished:
0
)
check_pipeline_response
(
returned:
1
,
all:
1
)
end
end
...
...
@@ -189,7 +180,7 @@ RSpec.describe Projects::PipelinesController do
it
'returns empty list'
do
get_pipelines_index_json
(
ref:
'invalid-ref'
)
check_pipeline_response
(
returned:
0
,
all:
0
,
running:
0
,
pending:
0
,
finished:
0
)
check_pipeline_response
(
returned:
0
,
all:
0
)
end
end
end
...
...
@@ -199,14 +190,14 @@ RSpec.describe Projects::PipelinesController do
it
'returns matched pipelines'
do
get_pipelines_index_json
(
status:
'success'
)
check_pipeline_response
(
returned:
1
,
all:
1
,
running:
0
,
pending:
0
,
finished:
1
)
check_pipeline_response
(
returned:
1
,
all:
1
)
end
context
'when filter by unrelated scope'
do
it
'returns empty list'
do
get_pipelines_index_json
(
status:
'success'
,
scope:
'running'
)
check_pipeline_response
(
returned:
0
,
all:
1
,
running:
0
,
pending:
0
,
finished:
1
)
check_pipeline_response
(
returned:
0
,
all:
1
)
end
end
end
...
...
@@ -215,7 +206,7 @@ RSpec.describe Projects::PipelinesController do
it
'returns empty list'
do
get_pipelines_index_json
(
status:
'manual'
)
check_pipeline_response
(
returned:
0
,
all:
0
,
running:
0
,
pending:
0
,
finished:
0
)
check_pipeline_response
(
returned:
0
,
all:
0
)
end
end
...
...
@@ -223,7 +214,7 @@ RSpec.describe Projects::PipelinesController do
it
'returns all list'
do
get_pipelines_index_json
(
status:
'invalid-status'
)
check_pipeline_response
(
returned:
6
,
all:
6
,
running:
2
,
pending:
1
,
finished:
3
)
check_pipeline_response
(
returned:
6
,
all:
6
)
end
end
end
...
...
@@ -284,15 +275,12 @@ RSpec.describe Projects::PipelinesController do
)
end
def
check_pipeline_response
(
returned
:,
all
:
,
running
:,
pending
:,
finished
:
)
def
check_pipeline_response
(
returned
:,
all
:)
aggregate_failures
do
expect
(
response
).
to
match_response_schema
(
'pipeline'
)
expect
(
json_response
[
'pipelines'
].
count
).
to
eq
returned
expect
(
json_response
[
'count'
][
'all'
].
to_i
).
to
eq
all
expect
(
json_response
[
'count'
][
'running'
].
to_i
).
to
eq
running
expect
(
json_response
[
'count'
][
'pending'
].
to_i
).
to
eq
pending
expect
(
json_response
[
'count'
][
'finished'
].
to_i
).
to
eq
finished
end
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