Commit 0d7bb4f6 authored by Thong Kuah's avatar Thong Kuah

Revert back to go but use arguments for some cases

It has been pointed out that `go` is used quite extensively so it's not
an unknown idiam here at GitLab. And we have arguments with `go` which
is a plus.
parent c5bca03b
...@@ -14,8 +14,8 @@ describe Projects::ClustersController do ...@@ -14,8 +14,8 @@ describe Projects::ClustersController do
end end
describe 'GET index' do describe 'GET index' do
subject do def go(params = {})
get :index, namespace_id: project.namespace.to_param, project_id: project get :index, params.reverse_merge(namespace_id: project.namespace.to_param, project_id: project)
end end
describe 'functionality' do describe 'functionality' do
...@@ -24,7 +24,7 @@ describe Projects::ClustersController do ...@@ -24,7 +24,7 @@ describe Projects::ClustersController do
let!(:enabled_cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let!(:enabled_cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
let!(:disabled_cluster) { create(:cluster, :disabled, :provided_by_gcp, :production_environment, projects: [project]) } let!(:disabled_cluster) { create(:cluster, :disabled, :provided_by_gcp, :production_environment, projects: [project]) }
it 'lists available clusters' do it 'lists available clusters' do
subject go
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index) expect(response).to render_template(:index)
...@@ -34,17 +34,13 @@ describe Projects::ClustersController do ...@@ -34,17 +34,13 @@ describe Projects::ClustersController do
context 'when page is specified' do context 'when page is specified' do
let(:last_page) { project.clusters.page.total_pages } let(:last_page) { project.clusters.page.total_pages }
subject do
get :index, namespace_id: project.namespace, project_id: project, page: last_page
end
before do before do
allow(Clusters::Cluster).to receive(:paginates_per).and_return(1) allow(Clusters::Cluster).to receive(:paginates_per).and_return(1)
create_list(:cluster, 2, :provided_by_gcp, :production_environment, projects: [project]) create_list(:cluster, 2, :provided_by_gcp, :production_environment, projects: [project])
end end
it 'redirects to the page' do it 'redirects to the page' do
subject go(page: last_page)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:clusters).current_page).to eq(last_page) expect(assigns(:clusters).current_page).to eq(last_page)
...@@ -56,7 +52,7 @@ describe Projects::ClustersController do ...@@ -56,7 +52,7 @@ describe Projects::ClustersController do
let(:project) { create(:project) } let(:project) { create(:project) }
it 'returns an empty state page' do it 'returns an empty state page' do
subject go
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index, partial: :empty_state) expect(response).to render_template(:index, partial: :empty_state)
...@@ -68,19 +64,19 @@ describe Projects::ClustersController do ...@@ -68,19 +64,19 @@ describe Projects::ClustersController do
describe 'security' do describe 'security' do
let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
it { expect { subject }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:admin) }
it { expect { subject }.to be_allowed_for(:owner).of(project) } it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { subject }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { subject }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { subject }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { subject }.to be_denied_for(:guest).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) }
it { expect { subject }.to be_denied_for(:user) } it { expect { go }.to be_denied_for(:user) }
it { expect { subject }.to be_denied_for(:external) } it { expect { go }.to be_denied_for(:external) }
end end
end end
describe 'GET new' do describe 'GET new' do
subject do def go
get :new, namespace_id: project.namespace, project_id: project get :new, namespace_id: project.namespace, project_id: project
end end
...@@ -96,7 +92,7 @@ describe Projects::ClustersController do ...@@ -96,7 +92,7 @@ describe Projects::ClustersController do
end end
it 'has authorize_url' do it 'has authorize_url' do
subject go
expect(assigns(:authorize_url)).to include(key) expect(assigns(:authorize_url)).to include(key)
expect(session[session_key_for_redirect_uri]).to eq(new_project_cluster_path(project)) expect(session[session_key_for_redirect_uri]).to eq(new_project_cluster_path(project))
...@@ -109,7 +105,7 @@ describe Projects::ClustersController do ...@@ -109,7 +105,7 @@ describe Projects::ClustersController do
end end
it 'does not have authorize_url' do it 'does not have authorize_url' do
subject go
expect(assigns(:authorize_url)).to be_nil expect(assigns(:authorize_url)).to be_nil
end end
...@@ -121,7 +117,7 @@ describe Projects::ClustersController do ...@@ -121,7 +117,7 @@ describe Projects::ClustersController do
end end
it 'has new object' do it 'has new object' do
subject go
expect(assigns(:gcp_cluster)).to be_an_instance_of(Clusters::Cluster) expect(assigns(:gcp_cluster)).to be_an_instance_of(Clusters::Cluster)
end end
...@@ -142,21 +138,21 @@ describe Projects::ClustersController do ...@@ -142,21 +138,21 @@ describe Projects::ClustersController do
describe 'functionality for existing cluster' do describe 'functionality for existing cluster' do
it 'has new object' do it 'has new object' do
subject go
expect(assigns(:user_cluster)).to be_an_instance_of(Clusters::Cluster) expect(assigns(:user_cluster)).to be_an_instance_of(Clusters::Cluster)
end end
end end
describe 'security' do describe 'security' do
it { expect { subject }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:admin) }
it { expect { subject }.to be_allowed_for(:owner).of(project) } it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { subject }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { subject }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { subject }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { subject }.to be_denied_for(:guest).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) }
it { expect { subject }.to be_denied_for(:user) } it { expect { go }.to be_denied_for(:user) }
it { expect { subject }.to be_denied_for(:external) } it { expect { go }.to be_denied_for(:external) }
end end
end end
...@@ -174,7 +170,7 @@ describe Projects::ClustersController do ...@@ -174,7 +170,7 @@ describe Projects::ClustersController do
} }
end end
subject do def go
post :create_gcp, params.merge(namespace_id: project.namespace, project_id: project) post :create_gcp, params.merge(namespace_id: project.namespace, project_id: project)
end end
...@@ -186,7 +182,7 @@ describe Projects::ClustersController do ...@@ -186,7 +182,7 @@ describe Projects::ClustersController do
it 'creates a new cluster' do it 'creates a new cluster' do
expect(ClusterProvisionWorker).to receive(:perform_async) expect(ClusterProvisionWorker).to receive(:perform_async)
expect { subject }.to change { Clusters::Cluster.count } expect { go }.to change { Clusters::Cluster.count }
.and change { Clusters::Providers::Gcp.count } .and change { Clusters::Providers::Gcp.count }
expect(response).to redirect_to(project_cluster_path(project, project.clusters.first)) expect(response).to redirect_to(project_cluster_path(project, project.clusters.first))
expect(project.clusters.first).to be_gcp expect(project.clusters.first).to be_gcp
...@@ -199,7 +195,7 @@ describe Projects::ClustersController do ...@@ -199,7 +195,7 @@ describe Projects::ClustersController do
it 'creates a new cluster with legacy_abac_disabled' do it 'creates a new cluster with legacy_abac_disabled' do
expect(ClusterProvisionWorker).to receive(:perform_async) expect(ClusterProvisionWorker).to receive(:perform_async)
expect { subject }.to change { Clusters::Cluster.count } expect { go }.to change { Clusters::Cluster.count }
.and change { Clusters::Providers::Gcp.count } .and change { Clusters::Providers::Gcp.count }
expect(project.clusters.first.provider_gcp).not_to be_legacy_abac expect(project.clusters.first.provider_gcp).not_to be_legacy_abac
end end
...@@ -236,14 +232,14 @@ describe Projects::ClustersController do ...@@ -236,14 +232,14 @@ describe Projects::ClustersController do
allow(WaitForClusterCreationWorker).to receive(:perform_in).and_return(nil) allow(WaitForClusterCreationWorker).to receive(:perform_in).and_return(nil)
end end
it { expect { subject }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:admin) }
it { expect { subject }.to be_allowed_for(:owner).of(project) } it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { subject }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { subject }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { subject }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { subject }.to be_denied_for(:guest).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) }
it { expect { subject }.to be_denied_for(:user) } it { expect { go }.to be_denied_for(:user) }
it { expect { subject }.to be_denied_for(:external) } it { expect { go }.to be_denied_for(:external) }
end end
end end
...@@ -261,7 +257,7 @@ describe Projects::ClustersController do ...@@ -261,7 +257,7 @@ describe Projects::ClustersController do
} }
end end
subject do def go
post :create_user, params.merge(namespace_id: project.namespace, project_id: project) post :create_user, params.merge(namespace_id: project.namespace, project_id: project)
end end
...@@ -270,7 +266,7 @@ describe Projects::ClustersController do ...@@ -270,7 +266,7 @@ describe Projects::ClustersController do
it 'creates a new cluster' do it 'creates a new cluster' do
expect(ClusterProvisionWorker).to receive(:perform_async) expect(ClusterProvisionWorker).to receive(:perform_async)
expect { subject }.to change { Clusters::Cluster.count } expect { go }.to change { Clusters::Cluster.count }
.and change { Clusters::Platforms::Kubernetes.count } .and change { Clusters::Platforms::Kubernetes.count }
expect(response).to redirect_to(project_cluster_path(project, project.clusters.first)) expect(response).to redirect_to(project_cluster_path(project, project.clusters.first))
...@@ -298,7 +294,7 @@ describe Projects::ClustersController do ...@@ -298,7 +294,7 @@ describe Projects::ClustersController do
it 'creates a new cluster' do it 'creates a new cluster' do
expect(ClusterProvisionWorker).to receive(:perform_async) expect(ClusterProvisionWorker).to receive(:perform_async)
expect { subject }.to change { Clusters::Cluster.count } expect { go }.to change { Clusters::Cluster.count }
.and change { Clusters::Platforms::Kubernetes.count } .and change { Clusters::Platforms::Kubernetes.count }
expect(response).to redirect_to(project_cluster_path(project, project.clusters.first)) expect(response).to redirect_to(project_cluster_path(project, project.clusters.first))
...@@ -311,21 +307,21 @@ describe Projects::ClustersController do ...@@ -311,21 +307,21 @@ describe Projects::ClustersController do
end end
describe 'security' do describe 'security' do
it { expect { subject }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:admin) }
it { expect { subject }.to be_allowed_for(:owner).of(project) } it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { subject }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { subject }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { subject }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { subject }.to be_denied_for(:guest).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) }
it { expect { subject }.to be_denied_for(:user) } it { expect { go }.to be_denied_for(:user) }
it { expect { subject }.to be_denied_for(:external) } it { expect { go }.to be_denied_for(:external) }
end end
end end
describe 'GET status' do describe 'GET status' do
let(:cluster) { create(:cluster, :providing_by_gcp, projects: [project]) } let(:cluster) { create(:cluster, :providing_by_gcp, projects: [project]) }
subject do def go
get :status, namespace_id: project.namespace, get :status, namespace_id: project.namespace,
project_id: project, project_id: project,
id: cluster, id: cluster,
...@@ -334,7 +330,7 @@ describe Projects::ClustersController do ...@@ -334,7 +330,7 @@ describe Projects::ClustersController do
describe 'functionality' do describe 'functionality' do
it "responds with matching schema" do it "responds with matching schema" do
subject go
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to match_response_schema('cluster_status') expect(response).to match_response_schema('cluster_status')
...@@ -343,26 +339,26 @@ describe Projects::ClustersController do ...@@ -343,26 +339,26 @@ describe Projects::ClustersController do
it 'invokes schedule_status_update on each application' do it 'invokes schedule_status_update on each application' do
expect_any_instance_of(Clusters::Applications::Ingress).to receive(:schedule_status_update) expect_any_instance_of(Clusters::Applications::Ingress).to receive(:schedule_status_update)
subject go
end end
end end
describe 'security' do describe 'security' do
it { expect { subject }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:admin) }
it { expect { subject }.to be_allowed_for(:owner).of(project) } it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { subject }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { subject }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { subject }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { subject }.to be_denied_for(:guest).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) }
it { expect { subject }.to be_denied_for(:user) } it { expect { go }.to be_denied_for(:user) }
it { expect { subject }.to be_denied_for(:external) } it { expect { go }.to be_denied_for(:external) }
end end
end end
describe 'GET show' do describe 'GET show' do
let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
subject do def go
get :show, namespace_id: project.namespace, get :show, namespace_id: project.namespace,
project_id: project, project_id: project,
id: cluster id: cluster
...@@ -370,7 +366,7 @@ describe Projects::ClustersController do ...@@ -370,7 +366,7 @@ describe Projects::ClustersController do
describe 'functionality' do describe 'functionality' do
it "renders view" do it "renders view" do
subject go
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(assigns(:cluster)).to eq(cluster) expect(assigns(:cluster)).to eq(cluster)
...@@ -378,14 +374,14 @@ describe Projects::ClustersController do ...@@ -378,14 +374,14 @@ describe Projects::ClustersController do
end end
describe 'security' do describe 'security' do
it { expect { subject }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:admin) }
it { expect { subject }.to be_allowed_for(:owner).of(project) } it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { subject }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { subject }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { subject }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { subject }.to be_denied_for(:guest).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) }
it { expect { subject }.to be_denied_for(:user) } it { expect { go }.to be_denied_for(:user) }
it { expect { subject }.to be_denied_for(:external) } it { expect { go }.to be_denied_for(:external) }
end end
end end
...@@ -404,15 +400,17 @@ describe Projects::ClustersController do ...@@ -404,15 +400,17 @@ describe Projects::ClustersController do
} }
end end
subject do def go(format: :html)
put :update, params.merge(namespace_id: project.namespace, put :update, params.merge(namespace_id: project.namespace,
project_id: project, project_id: project,
id: cluster) id: cluster,
format: format
)
end end
context 'when cluster is provided by GCP' do context 'when cluster is provided by GCP' do
it "updates and redirects back to show page" do it "updates and redirects back to show page" do
subject go
cluster.reload cluster.reload
expect(response).to redirect_to(project_cluster_path(project, cluster)) expect(response).to redirect_to(project_cluster_path(project, cluster))
...@@ -421,7 +419,7 @@ describe Projects::ClustersController do ...@@ -421,7 +419,7 @@ describe Projects::ClustersController do
end end
it "does not change cluster name" do it "does not change cluster name" do
subject go
cluster.reload cluster.reload
expect(cluster.name).to eq('test-cluster') expect(cluster.name).to eq('test-cluster')
...@@ -431,7 +429,7 @@ describe Projects::ClustersController do ...@@ -431,7 +429,7 @@ describe Projects::ClustersController do
let(:cluster) { create(:cluster, :providing_by_gcp, projects: [project]) } let(:cluster) { create(:cluster, :providing_by_gcp, projects: [project]) }
it "rejects changes" do it "rejects changes" do
subject go
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:show) expect(response).to render_template(:show)
...@@ -455,14 +453,8 @@ describe Projects::ClustersController do ...@@ -455,14 +453,8 @@ describe Projects::ClustersController do
} }
end end
subject do
put :update, params.merge(namespace_id: project.namespace,
project_id: project,
id: cluster)
end
it "updates and redirects back to show page" do it "updates and redirects back to show page" do
subject go
cluster.reload cluster.reload
expect(response).to redirect_to(project_cluster_path(project, cluster)) expect(response).to redirect_to(project_cluster_path(project, cluster))
...@@ -473,13 +465,6 @@ describe Projects::ClustersController do ...@@ -473,13 +465,6 @@ describe Projects::ClustersController do
end end
context 'when format is json' do context 'when format is json' do
subject do
put :update, params.merge(namespace_id: project.namespace,
project_id: project,
id: cluster,
format: :json)
end
context 'when changing parameters' do context 'when changing parameters' do
context 'when valid parameters are used' do context 'when valid parameters are used' do
let(:params) do let(:params) do
...@@ -495,7 +480,7 @@ describe Projects::ClustersController do ...@@ -495,7 +480,7 @@ describe Projects::ClustersController do
end end
it "updates and redirects back to show page" do it "updates and redirects back to show page" do
subject go(format: :json)
cluster.reload cluster.reload
expect(response).to have_http_status(:no_content) expect(response).to have_http_status(:no_content)
...@@ -518,7 +503,7 @@ describe Projects::ClustersController do ...@@ -518,7 +503,7 @@ describe Projects::ClustersController do
end end
it "rejects changes" do it "rejects changes" do
subject go(format: :json)
expect(response).to have_http_status(:bad_request) expect(response).to have_http_status(:bad_request)
end end
...@@ -530,21 +515,21 @@ describe Projects::ClustersController do ...@@ -530,21 +515,21 @@ describe Projects::ClustersController do
describe 'security' do describe 'security' do
set(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } set(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) }
it { expect { subject }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:admin) }
it { expect { subject }.to be_allowed_for(:owner).of(project) } it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { subject }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { subject }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { subject }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { subject }.to be_denied_for(:guest).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) }
it { expect { subject }.to be_denied_for(:user) } it { expect { go }.to be_denied_for(:user) }
it { expect { subject }.to be_denied_for(:external) } it { expect { go }.to be_denied_for(:external) }
end end
end end
describe 'DELETE destroy' do describe 'DELETE destroy' do
let!(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, projects: [project]) } let!(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, projects: [project]) }
subject do def go
delete :destroy, namespace_id: project.namespace, delete :destroy, namespace_id: project.namespace,
project_id: project, project_id: project,
id: cluster id: cluster
...@@ -554,7 +539,7 @@ describe Projects::ClustersController do ...@@ -554,7 +539,7 @@ describe Projects::ClustersController do
context 'when cluster is provided by GCP' do context 'when cluster is provided by GCP' do
context 'when cluster is created' do context 'when cluster is created' do
it "destroys and redirects back to clusters list" do it "destroys and redirects back to clusters list" do
expect { subject } expect { go }
.to change { Clusters::Cluster.count }.by(-1) .to change { Clusters::Cluster.count }.by(-1)
.and change { Clusters::Platforms::Kubernetes.count }.by(-1) .and change { Clusters::Platforms::Kubernetes.count }.by(-1)
.and change { Clusters::Providers::Gcp.count }.by(-1) .and change { Clusters::Providers::Gcp.count }.by(-1)
...@@ -568,7 +553,7 @@ describe Projects::ClustersController do ...@@ -568,7 +553,7 @@ describe Projects::ClustersController do
let!(:cluster) { create(:cluster, :providing_by_gcp, :production_environment, projects: [project]) } let!(:cluster) { create(:cluster, :providing_by_gcp, :production_environment, projects: [project]) }
it "destroys and redirects back to clusters list" do it "destroys and redirects back to clusters list" do
expect { subject } expect { go }
.to change { Clusters::Cluster.count }.by(-1) .to change { Clusters::Cluster.count }.by(-1)
.and change { Clusters::Providers::Gcp.count }.by(-1) .and change { Clusters::Providers::Gcp.count }.by(-1)
...@@ -582,7 +567,7 @@ describe Projects::ClustersController do ...@@ -582,7 +567,7 @@ describe Projects::ClustersController do
let!(:cluster) { create(:cluster, :provided_by_user, :production_environment, projects: [project]) } let!(:cluster) { create(:cluster, :provided_by_user, :production_environment, projects: [project]) }
it "destroys and redirects back to clusters list" do it "destroys and redirects back to clusters list" do
expect { subject } expect { go }
.to change { Clusters::Cluster.count }.by(-1) .to change { Clusters::Cluster.count }.by(-1)
.and change { Clusters::Platforms::Kubernetes.count }.by(-1) .and change { Clusters::Platforms::Kubernetes.count }.by(-1)
.and change { Clusters::Providers::Gcp.count }.by(0) .and change { Clusters::Providers::Gcp.count }.by(0)
...@@ -596,14 +581,14 @@ describe Projects::ClustersController do ...@@ -596,14 +581,14 @@ describe Projects::ClustersController do
describe 'security' do describe 'security' do
set(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, projects: [project]) } set(:cluster) { create(:cluster, :provided_by_gcp, :production_environment, projects: [project]) }
it { expect { subject }.to be_allowed_for(:admin) } it { expect { go }.to be_allowed_for(:admin) }
it { expect { subject }.to be_allowed_for(:owner).of(project) } it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { subject }.to be_allowed_for(:maintainer).of(project) } it { expect { go }.to be_allowed_for(:maintainer).of(project) }
it { expect { subject }.to be_denied_for(:developer).of(project) } it { expect { go }.to be_denied_for(:developer).of(project) }
it { expect { subject }.to be_denied_for(:reporter).of(project) } it { expect { go }.to be_denied_for(:reporter).of(project) }
it { expect { subject }.to be_denied_for(:guest).of(project) } it { expect { go }.to be_denied_for(:guest).of(project) }
it { expect { subject }.to be_denied_for(:user) } it { expect { go }.to be_denied_for(:user) }
it { expect { subject }.to be_denied_for(:external) } it { expect { go }.to be_denied_for(:external) }
end end
end 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