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
fd4faf34
Commit
fd4faf34
authored
Sep 20, 2021
by
Tiger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Clusters::AgentsFinder to core
parent
dbf27167
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
12 deletions
+1
-12
app/finders/clusters/agents_finder.rb
app/finders/clusters/agents_finder.rb
+1
-1
spec/finders/clusters/agents_finder_spec.rb
spec/finders/clusters/agents_finder_spec.rb
+0
-11
No files found.
ee/
app/finders/clusters/agents_finder.rb
→
app/finders/clusters/agents_finder.rb
View file @
fd4faf34
...
@@ -22,7 +22,7 @@ module Clusters
...
@@ -22,7 +22,7 @@ module Clusters
attr_reader
:project
,
:current_user
,
:params
attr_reader
:project
,
:current_user
,
:params
def
can_read_cluster_agents?
def
can_read_cluster_agents?
project
.
feature_available?
(
:cluster_agents
)
&&
current_user
.
can?
(
:read_cluster
,
project
)
current_user
.
can?
(
:read_cluster
,
project
)
end
end
end
end
end
end
ee/
spec/finders/clusters/agents_finder_spec.rb
→
spec/finders/clusters/agents_finder_spec.rb
View file @
fd4faf34
...
@@ -6,25 +6,14 @@ RSpec.describe Clusters::AgentsFinder do
...
@@ -6,25 +6,14 @@ RSpec.describe Clusters::AgentsFinder do
describe
'#execute'
do
describe
'#execute'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
,
maintainer_projects:
[
project
])
}
let
(
:user
)
{
create
(
:user
,
maintainer_projects:
[
project
])
}
let
(
:feature_available
)
{
true
}
let!
(
:matching_agent
)
{
create
(
:cluster_agent
,
project:
project
)
}
let!
(
:matching_agent
)
{
create
(
:cluster_agent
,
project:
project
)
}
let!
(
:wrong_project
)
{
create
(
:cluster_agent
)
}
let!
(
:wrong_project
)
{
create
(
:cluster_agent
)
}
subject
{
described_class
.
new
(
project
,
user
).
execute
}
subject
{
described_class
.
new
(
project
,
user
).
execute
}
before
do
stub_licensed_features
(
cluster_agents:
feature_available
)
end
it
{
is_expected
.
to
contain_exactly
(
matching_agent
)
}
it
{
is_expected
.
to
contain_exactly
(
matching_agent
)
}
context
'feature is not available'
do
let
(
:feature_available
)
{
false
}
it
{
is_expected
.
to
be_empty
}
end
context
'user does not have permission'
do
context
'user does not have permission'
do
let
(
:user
)
{
create
(
:user
,
developer_projects:
[
project
])
}
let
(
:user
)
{
create
(
:user
,
developer_projects:
[
project
])
}
...
...
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