diff options
Diffstat (limited to 'spec/requests/api/project_clusters_spec.rb')
-rw-r--r-- | spec/requests/api/project_clusters_spec.rb | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/spec/requests/api/project_clusters_spec.rb b/spec/requests/api/project_clusters_spec.rb index 81442125a1c..94e6ca2c07c 100644 --- a/spec/requests/api/project_clusters_spec.rb +++ b/spec/requests/api/project_clusters_spec.rb @@ -22,7 +22,7 @@ describe API::ProjectClusters do end context 'non-authorized user' do - it 'should respond with 404' do + it 'responds with 404' do get api("/projects/#{project.id}/clusters", non_member) expect(response).to have_gitlab_http_status(404) @@ -34,15 +34,15 @@ describe API::ProjectClusters do get api("/projects/#{project.id}/clusters", current_user) end - it 'should respond with 200' do + it 'responds with 200' do expect(response).to have_gitlab_http_status(200) end - it 'should include pagination headers' do + it 'includes pagination headers' do expect(response).to include_pagination_headers end - it 'should only include authorized clusters' do + it 'onlies include authorized clusters' do cluster_ids = json_response.map { |cluster| cluster['id'] } expect(cluster_ids).to match_array(clusters.pluck(:id)) @@ -67,7 +67,7 @@ describe API::ProjectClusters do end context 'non-authorized user' do - it 'should respond with 404' do + it 'responds with 404' do get api("/projects/#{project.id}/clusters/#{cluster_id}", non_member) expect(response).to have_gitlab_http_status(404) @@ -132,7 +132,7 @@ describe API::ProjectClusters do projects: [project]) end - it 'should not include GCP provider info' do + it 'does not include GCP provider info' do expect(json_response['provider_gcp']).not_to be_present end end @@ -194,7 +194,7 @@ describe API::ProjectClusters do end context 'non-authorized user' do - it 'should respond with 404' do + it 'responds with 404' do post api("/projects/#{project.id}/clusters/user", non_member), params: cluster_params expect(response).to have_gitlab_http_status(404) @@ -207,11 +207,11 @@ describe API::ProjectClusters do end context 'with valid params' do - it 'should respond with 201' do + it 'responds with 201' do expect(response).to have_gitlab_http_status(201) end - it 'should create a new Cluster::Cluster' do + it 'creates a new Cluster::Cluster' do cluster_result = Clusters::Cluster.find(json_response["id"]) platform_kubernetes = cluster_result.platform @@ -246,7 +246,7 @@ describe API::ProjectClusters do context 'when user sets authorization type as ABAC' do let(:authorization_type) { 'abac' } - it 'should create an ABAC cluster' do + it 'creates an ABAC cluster' do cluster_result = Clusters::Cluster.find(json_response['id']) expect(cluster_result.platform.abac?).to be_truthy @@ -256,15 +256,15 @@ describe API::ProjectClusters do context 'with invalid params' do let(:namespace) { 'invalid_namespace' } - it 'should respond with 400' do + it 'responds with 400' do expect(response).to have_gitlab_http_status(400) end - it 'should not create a new Clusters::Cluster' do + it 'does not create a new Clusters::Cluster' do expect(project.reload.clusters).to be_empty end - it 'should return validation errors' do + it 'returns validation errors' do expect(json_response['message']['platform_kubernetes.namespace'].first).to be_present end end @@ -278,11 +278,11 @@ describe API::ProjectClusters do post api("/projects/#{project.id}/clusters/user", current_user), params: cluster_params end - it 'should respond with 403' do + it 'responds with 403' do expect(response).to have_gitlab_http_status(403) end - it 'should return an appropriate message' do + it 'returns an appropriate message' do expect(json_response['message']).to include('Instance does not support multiple Kubernetes clusters') end end @@ -314,7 +314,7 @@ describe API::ProjectClusters do end context 'non-authorized user' do - it 'should respond with 404' do + it 'responds with 404' do put api("/projects/#{project.id}/clusters/#{cluster.id}", non_member), params: update_params expect(response).to have_gitlab_http_status(404) @@ -329,11 +329,11 @@ describe API::ProjectClusters do end context 'with valid params' do - it 'should respond with 200' do + it 'responds with 200' do expect(response).to have_gitlab_http_status(200) end - it 'should update cluster attributes' do + it 'updates cluster attributes' do expect(cluster.domain).to eq('new-domain.com') expect(cluster.platform_kubernetes.namespace).to eq('new-namespace') end @@ -342,17 +342,17 @@ describe API::ProjectClusters do context 'with invalid params' do let(:namespace) { 'invalid_namespace' } - it 'should respond with 400' do + it 'responds with 400' do expect(response).to have_gitlab_http_status(400) end - it 'should not update cluster attributes' do + it 'does not update cluster attributes' do expect(cluster.domain).not_to eq('new_domain.com') expect(cluster.platform_kubernetes.namespace).not_to eq('invalid_namespace') expect(cluster.kubernetes_namespace.namespace).not_to eq('invalid_namespace') end - it 'should return validation errors' do + it 'returns validation errors' do expect(json_response['message']['platform_kubernetes.namespace'].first).to match('can contain only lowercase letters') end end @@ -366,11 +366,11 @@ describe API::ProjectClusters do } end - it 'should respond with 400' do + it 'responds with 400' do expect(response).to have_gitlab_http_status(400) end - it 'should return validation error' do + it 'returns validation error' do expect(json_response['message']['platform_kubernetes.base'].first).to eq('Cannot modify managed Kubernetes cluster') end end @@ -378,7 +378,7 @@ describe API::ProjectClusters do context 'when user tries to change namespace' do let(:namespace) { 'new-namespace' } - it 'should respond with 200' do + it 'responds with 200' do expect(response).to have_gitlab_http_status(200) end end @@ -407,11 +407,11 @@ describe API::ProjectClusters do } end - it 'should respond with 200' do + it 'responds with 200' do expect(response).to have_gitlab_http_status(200) end - it 'should update platform kubernetes attributes' do + it 'updates platform kubernetes attributes' do platform_kubernetes = cluster.platform_kubernetes expect(cluster.name).to eq('new-name') @@ -424,7 +424,7 @@ describe API::ProjectClusters do context 'with a cluster that does not belong to user' do let(:cluster) { create(:cluster, :project, :provided_by_user) } - it 'should respond with 404' do + it 'responds with 404' do expect(response).to have_gitlab_http_status(404) end end @@ -440,7 +440,7 @@ describe API::ProjectClusters do end context 'non-authorized user' do - it 'should respond with 404' do + it 'responds with 404' do delete api("/projects/#{project.id}/clusters/#{cluster.id}", non_member), params: cluster_params expect(response).to have_gitlab_http_status(404) @@ -452,18 +452,18 @@ describe API::ProjectClusters do delete api("/projects/#{project.id}/clusters/#{cluster.id}", current_user), params: cluster_params end - it 'should respond with 204' do + it 'responds with 204' do expect(response).to have_gitlab_http_status(204) end - it 'should delete the cluster' do + it 'deletes the cluster' do expect(Clusters::Cluster.exists?(id: cluster.id)).to be_falsy end context 'with a cluster that does not belong to user' do let(:cluster) { create(:cluster, :project, :provided_by_user) } - it 'should respond with 404' do + it 'responds with 404' do expect(response).to have_gitlab_http_status(404) end end |