Commit 6f9a3a1d authored by Stan Hu's avatar Stan Hu

Merge branch 'move-agents-finder-to-core' into 'master'

Move Clusters::AgentsFinder to core

See merge request gitlab-org/gitlab!70665
parents 5be5c608 fd4faf34
......@@ -22,7 +22,7 @@ module Clusters
attr_reader :project, :current_user, :params
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
......@@ -6,25 +6,14 @@ RSpec.describe Clusters::AgentsFinder do
describe '#execute' do
let(:project) { create(:project) }
let(:user) { create(:user, maintainer_projects: [project]) }
let(:feature_available) { true }
let!(:matching_agent) { create(:cluster_agent, project: project) }
let!(:wrong_project) { create(:cluster_agent) }
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) }
context 'feature is not available' do
let(:feature_available) { false }
it { is_expected.to be_empty }
end
context 'user does not have permission' do
let(:user) { create(:user, developer_projects: [project]) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment