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
a5f9e49f
Commit
a5f9e49f
authored
Mar 29, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add user_provided and gcp_provided cluster scopes
parent
427eeb43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+2
-0
spec/models/clusters/cluster_spec.rb
spec/models/clusters/cluster_spec.rb
+24
-0
No files found.
app/models/clusters/cluster.rb
View file @
a5f9e49f
...
...
@@ -50,6 +50,8 @@ module Clusters
scope
:enabled
,
->
{
where
(
enabled:
true
)
}
scope
:disabled
,
->
{
where
(
enabled:
false
)
}
scope
:user_provided
,
->
{
where
(
provider_type:
::
Clusters
::
Cluster
.
provider_types
[
:user
])
}
scope
:gcp_provided
,
->
{
where
(
provider_type:
::
Clusters
::
Cluster
.
provider_types
[
:gcp
])
}
def
status_name
if
provider
...
...
spec/models/clusters/cluster_spec.rb
View file @
a5f9e49f
...
...
@@ -39,6 +39,30 @@ describe Clusters::Cluster do
it
{
is_expected
.
to
contain_exactly
(
cluster
)
}
end
describe
'.user_provided'
do
subject
{
described_class
.
user_provided
}
let!
(
:cluster
)
{
create
(
:cluster
,
:provided_by_user
)
}
before
do
create
(
:cluster
,
:provided_by_gcp
)
end
it
{
is_expected
.
to
contain_exactly
(
cluster
)
}
end
describe
'.gcp_provided'
do
subject
{
described_class
.
gcp_provided
}
let!
(
:cluster
)
{
create
(
:cluster
,
:provided_by_gcp
)
}
before
do
create
(
:cluster
,
:provided_by_user
)
end
it
{
is_expected
.
to
contain_exactly
(
cluster
)
}
end
describe
'validation'
do
subject
{
cluster
.
valid?
}
...
...
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