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
67006888
Commit
67006888
authored
Apr 01, 2020
by
Tiger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add .with_management_project scope to clusters
parent
b8a12f40
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
app/models/clusters/cluster.rb
app/models/clusters/cluster.rb
+1
-0
spec/models/clusters/cluster_spec.rb
spec/models/clusters/cluster_spec.rb
+16
-0
No files found.
app/models/clusters/cluster.rb
View file @
67006888
...
...
@@ -123,6 +123,7 @@ module Clusters
scope
:managed
,
->
{
where
(
managed:
true
)
}
scope
:with_persisted_applications
,
->
{
eager_load
(
*
APPLICATIONS_ASSOCIATIONS
)
}
scope
:default_environment
,
->
{
where
(
environment_scope:
DEFAULT_ENVIRONMENT
)
}
scope
:with_management_project
,
->
{
where
.
not
(
management_project:
nil
)
}
scope
:for_project_namespace
,
->
(
namespace_id
)
{
joins
(
:projects
).
where
(
projects:
{
namespace_id:
namespace_id
})
}
...
...
spec/models/clusters/cluster_spec.rb
View file @
67006888
...
...
@@ -156,6 +156,22 @@ describe Clusters::Cluster, :use_clean_rails_memory_store_caching do
end
end
describe
'.with_management_project'
do
subject
{
described_class
.
with_management_project
}
context
'cluster has a management project'
do
let!
(
:cluster
)
{
create
(
:cluster
,
:management_project
)
}
it
{
is_expected
.
to
include
(
cluster
)
}
end
context
'cluster does not have a management project'
do
let!
(
:cluster
)
{
create
(
:cluster
)
}
it
{
is_expected
.
not_to
include
(
cluster
)
}
end
end
describe
'.for_project_namespace'
do
subject
{
described_class
.
for_project_namespace
(
namespace_id
)
}
...
...
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