diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-12-05 18:26:12 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-12-05 18:26:12 +0900 |
commit | 445a41091b45e593b02626f2bd4c34621c0021f7 (patch) | |
tree | 50593e61c7c532cc0657a9bb880c071993d91198 | |
parent | a5109c69fe140742164299b12205f7362a60c994 (diff) | |
download | gitlab-ce-445a41091b45e593b02626f2bd4c34621c0021f7.tar.gz |
Clean up clusters_controller_spec.rb
-rw-r--r-- | spec/controllers/projects/clusters_controller_spec.rb | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb index b79f0c3151f..66e67652dad 100644 --- a/spec/controllers/projects/clusters_controller_spec.rb +++ b/spec/controllers/projects/clusters_controller_spec.rb @@ -120,7 +120,7 @@ describe Projects::ClustersController do end describe 'PUT update' do - context 'Managed' do + context 'when cluster is provided by GCP' do let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let(:user) { create(:user) } @@ -171,7 +171,7 @@ describe Projects::ClustersController do end end - context 'User' do + context 'when cluster is provided by user' do let(:cluster) { create(:cluster, :provided_by_user, projects: [project]) } let(:user) { create(:user) } @@ -203,23 +203,11 @@ describe Projects::ClustersController do expect(cluster.name).to eq('my-new-cluster-name') expect(cluster.platform_kubernetes.namespace).to eq('my-namespace') end - - context 'when cluster is being created' do - let(:cluster) { create(:cluster, :providing_by_gcp, projects: [project]) } - - it "rejects changes" do - go - - expect(response).to have_gitlab_http_status(:ok) - expect(response).to render_template(:show) - expect(cluster.enabled).to be_truthy - end - end end end describe 'security' do - set(:cluster) { create(:cluster, :providing_by_gcp, projects: [project]) } + set(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } let(:params) do { cluster: { enabled: false } } @@ -251,7 +239,7 @@ describe Projects::ClustersController do sign_in(user) end - context 'GCP' do + context 'when cluster is provided by GCP' do context 'when cluster is created' do let!(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } @@ -280,19 +268,17 @@ describe Projects::ClustersController do end end - context 'User' do - context 'when provider is user' do - let!(:cluster) { create(:cluster, :provided_by_user, projects: [project]) } + context 'when cluster is provided by user' do + let!(:cluster) { create(:cluster, :provided_by_user, projects: [project]) } - it "destroys and redirects back to clusters list" do - expect { go } - .to change { Clusters::Cluster.count }.by(-1) - .and change { Clusters::Platforms::Kubernetes.count }.by(-1) - .and change { Clusters::Providers::Gcp.count }.by(0) + it "destroys and redirects back to clusters list" do + expect { go } + .to change { Clusters::Cluster.count }.by(-1) + .and change { Clusters::Platforms::Kubernetes.count }.by(-1) + .and change { Clusters::Providers::Gcp.count }.by(0) - expect(response).to redirect_to(project_clusters_path(project)) - expect(flash[:notice]).to eq('Cluster integration was successfully removed.') - end + expect(response).to redirect_to(project_clusters_path(project)) + expect(flash[:notice]).to eq('Cluster integration was successfully removed.') end end end |