summaryrefslogtreecommitdiff
path: root/spec/services/clusters
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-10-19 14:42:30 +1300
committerThong Kuah <tkuah@gitlab.com>2018-11-01 19:36:58 +1300
commit88800abcd8741b07114c2850e00b74fbecfbf90e (patch)
tree06dcb6a6a8036164eb73df0da2cc13150357dda7 /spec/services/clusters
parent5b3c096c9e0c9e8e7e1cb35c1b9e347995b948f5 (diff)
downloadgitlab-ce-88800abcd8741b07114c2850e00b74fbecfbf90e.tar.gz
Abstract out project out of ClustersController
To the extent possible swap out `project` with `clusterable` - Abstract paths for showing cluster or clusters. This will allow us to swap in alternative paths for group level cluster - Push :project_id and :namespace_id params from the URL to the POST body. - Create a nice helper for to generate links for the destroy action For some reason, spec :project_id and :namespace_id param are not going through `to_param` for a JSON format. Manually call `to_param` to fix specs. - Move :layout to BaseController
Diffstat (limited to 'spec/services/clusters')
-rw-r--r--spec/services/clusters/create_service_spec.rb31
1 files changed, 28 insertions, 3 deletions
diff --git a/spec/services/clusters/create_service_spec.rb b/spec/services/clusters/create_service_spec.rb
index 3959295c13e..274880f2c49 100644
--- a/spec/services/clusters/create_service_spec.rb
+++ b/spec/services/clusters/create_service_spec.rb
@@ -5,18 +5,43 @@ describe Clusters::CreateService do
let(:project) { create(:project) }
let(:user) { create(:user) }
- subject { described_class.new(user, params).execute(project: project, access_token: access_token) }
+ subject { described_class.new(user, params).execute(access_token: access_token) }
context 'when provider is gcp' do
context 'when project has no clusters' do
context 'when correct params' do
- include_context 'valid cluster create params'
+ let(:params) do
+ {
+ name: 'test-cluster',
+ provider_type: :gcp,
+ provider_gcp_attributes: {
+ gcp_project_id: 'gcp-project',
+ zone: 'us-central1-a',
+ num_nodes: 1,
+ machine_type: 'machine_type-a',
+ legacy_abac: 'true'
+ },
+ clusterable: project
+ }
+ end
include_examples 'create cluster service success'
end
context 'when invalid params' do
- include_context 'invalid cluster create params'
+ let(:params) do
+ {
+ name: 'test-cluster',
+ provider_type: :gcp,
+ provider_gcp_attributes: {
+ gcp_project_id: '!!!!!!!',
+ zone: 'us-central1-a',
+ num_nodes: 1,
+ machine_type: 'machine_type-a'
+ },
+ clusterable: project
+ }
+ end
include_examples 'create cluster service error'
end