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
Jérome Perrin
gitlab-ce
Commits
4d75901c
Commit
4d75901c
authored
Dec 05, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ClustersFinder for setting counts
parent
f81503a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
app/controllers/projects/clusters_controller.rb
app/controllers/projects/clusters_controller.rb
+3
-4
spec/controllers/projects/clusters_controller_spec.rb
spec/controllers/projects/clusters_controller_spec.rb
+4
-5
No files found.
app/controllers/projects/clusters_controller.rb
View file @
4d75901c
...
@@ -9,10 +9,9 @@ class Projects::ClustersController < Projects::ApplicationController
...
@@ -9,10 +9,9 @@ class Projects::ClustersController < Projects::ApplicationController
def
index
def
index
@scope
=
params
[
:scope
]
||
'all'
@scope
=
params
[
:scope
]
||
'all'
clusters
=
ClustersFinder
.
new
(
project
,
current_user
,
@scope
).
execute
@clusters
=
ClustersFinder
.
new
(
project
,
current_user
,
@scope
).
execute
.
page
(
params
[
:page
])
@clusters
=
clusters
.
page
(
params
[
:page
])
@active_count
=
ClustersFinder
.
new
(
project
,
current_user
,
:active
).
execute
.
count
@active_count
=
project
.
clusters
.
enabled
.
count
@inactive_count
=
ClustersFinder
.
new
(
project
,
current_user
,
:inactive
).
execute
.
count
@inactive_count
=
project
.
clusters
.
disabled
.
count
@all_count
=
@active_count
+
@inactive_count
@all_count
=
@active_count
+
@inactive_count
end
end
...
...
spec/controllers/projects/clusters_controller_spec.rb
View file @
4d75901c
...
@@ -17,9 +17,8 @@ describe Projects::ClustersController do
...
@@ -17,9 +17,8 @@ describe Projects::ClustersController do
context
'when project has one or more clusters'
do
context
'when project has one or more clusters'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:enabled_cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
projects:
[
project
])
}
let!
(
:enabled_cluster
)
{
create
(
:cluster
,
:provided_by_gcp
,
projects:
[
project
])
}
let
(
:disabled_cluster
)
{
create
(
:cluster
,
:disabled
,
:provided_by_gcp
,
projects:
[
project
])
}
let!
(
:disabled_cluster
)
{
create
(
:cluster
,
:disabled
,
:provided_by_gcp
,
projects:
[
project
])
}
it
'lists available clusters'
do
it
'lists available clusters'
do
go
go
...
@@ -31,8 +30,8 @@ describe Projects::ClustersController do
...
@@ -31,8 +30,8 @@ describe Projects::ClustersController do
it
'assigns counters to correct values'
do
it
'assigns counters to correct values'
do
go
go
expect
(
assigns
(
:active_count
)).
to
eq
(
project
.
clusters
.
enabled
.
count
)
expect
(
assigns
(
:active_count
)).
to
eq
(
1
)
expect
(
assigns
(
:inactive_count
)).
to
eq
(
project
.
clusters
.
disabled
.
count
)
expect
(
assigns
(
:inactive_count
)).
to
eq
(
1
)
end
end
context
'when page is specified'
do
context
'when page is specified'
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