diff options
author | Matija Čupić <matteeyah@gmail.com> | 2017-12-21 19:25:28 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2017-12-21 19:25:28 +0100 |
commit | e395a2c1901aa08c5d1f26f94406552db44140fa (patch) | |
tree | 946ff7c3f46b073259540016d5b47c905824dedb /spec/controllers/projects/clusters/gcp_controller_spec.rb | |
parent | 59c7f46e2aa33d633fdc3f78c8a4faa792e40972 (diff) | |
download | gitlab-ce-e395a2c1901aa08c5d1f26f94406552db44140fa.tar.gz |
Implement GCP billing check in cluster form
Diffstat (limited to 'spec/controllers/projects/clusters/gcp_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/clusters/gcp_controller_spec.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/controllers/projects/clusters/gcp_controller_spec.rb b/spec/controllers/projects/clusters/gcp_controller_spec.rb index 485b67de30a..be19fa93183 100644 --- a/spec/controllers/projects/clusters/gcp_controller_spec.rb +++ b/spec/controllers/projects/clusters/gcp_controller_spec.rb @@ -77,6 +77,8 @@ describe Projects::Clusters::GcpController do end it 'has new object' do + expect(controller).to receive(:authorize_google_project_billing) + go expect(assigns(:cluster)).to be_an_instance_of(Clusters::Cluster) @@ -137,7 +139,11 @@ describe Projects::Clusters::GcpController do stub_google_api_validate_token end - context 'when creates a cluster on gke' do + context 'when google project billing is enabled' do + before do + stub_google_project_billing_status + end + it 'creates a new cluster' do expect(ClusterProvisionWorker).to receive(:perform_async) expect { go }.to change { Clusters::Cluster.count } @@ -147,6 +153,15 @@ describe Projects::Clusters::GcpController do expect(project.clusters.first).to be_kubernetes end end + + context 'when google project billing is not enabled' do + it 'renders the cluster form with an error' do + go + + expect(response).to set_flash[:error] + expect(response).to render_template('new') + end + end end context 'when access token is expired' do |