summaryrefslogtreecommitdiff
path: root/spec/controllers/projects
diff options
context:
space:
mode:
authorDennis Tang <dtang@gitlab.com>2018-06-01 21:22:07 -0700
committerDennis Tang <dtang@gitlab.com>2018-06-01 21:22:07 -0700
commitfcb7b31ce0e5b1f38be08bb6468609d1d69734ea (patch)
tree8aca5b4c702a82e29a86dbe2dddba5d8f0692323 /spec/controllers/projects
parent5b3345a0b89df6a86c6cf95a12a75984abf1de25 (diff)
downloadgitlab-ce-fcb7b31ce0e5b1f38be08bb6468609d1d69734ea.tar.gz
fix tests for new cluster POST
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r--spec/controllers/projects/clusters_controller_spec.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/controllers/projects/clusters_controller_spec.rb b/spec/controllers/projects/clusters_controller_spec.rb
index 314384a6543..c4f43fd6bb4 100644
--- a/spec/controllers/projects/clusters_controller_spec.rb
+++ b/spec/controllers/projects/clusters_controller_spec.rb
@@ -176,7 +176,7 @@ describe Projects::ClustersController do
cluster: {
name: 'new-cluster',
provider_gcp_attributes: {
- gcp_project_id: '111'
+ gcp_project_id: 'gcp-project-12345'
}
}
}
@@ -219,6 +219,22 @@ describe Projects::ClustersController do
end
describe 'security' do
+ before do
+ allow_any_instance_of(described_class)
+ .to receive(:token_in_session).and_return('token')
+ allow_any_instance_of(described_class)
+ .to receive(:expires_at_in_session).and_return(1.hour.since.to_i.to_s)
+ allow_any_instance_of(GoogleApi::CloudPlatform::Client)
+ .to receive(:projects_zones_clusters_create) do
+ OpenStruct.new(
+ self_link: 'projects/gcp-project-12345/zones/us-central1-a/operations/ope-123',
+ status: 'RUNNING'
+ )
+ end
+
+ allow(WaitForClusterCreationWorker).to receive(:perform_in).and_return(nil)
+ end
+
it { expect { go }.to be_allowed_for(:admin) }
it { expect { go }.to be_allowed_for(:owner).of(project) }
it { expect { go }.to be_allowed_for(:master).of(project) }