Commit ede95291 authored by Tiger's avatar Tiger

Move cluster agent controller and views to core

https://gitlab.com/gitlab-org/gitlab/-/merge_requests/70887
parent b51e7099
......@@ -12,7 +12,7 @@ class Projects::ClusterAgentsController < Projects::ApplicationController
private
def authorize_can_read_cluster_agent!
return if can?(current_user, :admin_cluster, project) && project.feature_available?(:cluster_agents)
return if can?(current_user, :admin_cluster, project)
access_denied!
end
......
......@@ -13,34 +13,6 @@ RSpec.describe 'ClusterAgents', :js do
gitlab_sign_in(user)
end
context 'non-premium user' do
before do
stub_licensed_features(cluster_agents: false)
end
context 'when user visits agents index page' do
before do
visit project_clusters_path(project)
end
it 'does not display agent information', :aggregate_failures do
expect(page).to have_content('Integrate with a cluster certificate')
expect(page).not_to have_content('GitLab Agent managed clusters')
end
end
context 'when user visits agents show page' do
before do
visit project_cluster_agent_path(project, agent.name)
end
it 'displays not found' do
expect(page).to have_title('Not Found')
expect(page).to have_content('Page Not Found')
end
end
end
context 'premium user' do
before do
stub_licensed_features(cluster_agents: true)
......
......@@ -27,27 +27,13 @@ RSpec.describe Projects::ClusterAgentsController do
context 'when user is authorized' do
let(:user) { project.creator }
context 'without premium plan' do
before do
sign_in(user)
subject
end
it 'shows 404' do
expect(response).to have_gitlab_http_status(:not_found)
end
before do
sign_in(user)
subject
end
context 'with premium plan' do
before do
stub_licensed_features(cluster_agents: true)
sign_in(user)
subject
end
it 'renders content' do
expect(response).to be_successful
end
it 'renders content' do
expect(response).to be_successful
end
end
end
......
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