diff options
| author | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-11-30 11:01:14 +0000 |
|---|---|---|
| committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2017-11-30 11:01:14 +0000 |
| commit | feece7713247a063bfa71ab701f8a164e6fa71bb (patch) | |
| tree | a1de74f546c74cee85b4c5520e9de8ed45451048 /spec/controllers | |
| parent | 41aa9fa7362d213e469c6aa9021abd0569e9f332 (diff) | |
| parent | 7277b3b32c2afd26a033ecf81b93319efb65861d (diff) | |
| download | gitlab-ce-feece7713247a063bfa71ab701f8a164e6fa71bb.tar.gz | |
Merge branch '38668-revert-copied-kubernetesservice-logic' into 'master'
Copy `KubernetesService` logic in `Clusters::Platforms::Kubernetes` to make it interchangeable. And implement a selector.
See merge request gitlab-org/gitlab-ce!15515
Diffstat (limited to 'spec/controllers')
| -rw-r--r-- | spec/controllers/projects/branches_controller_spec.rb | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb index 973d6fed288..d731200f70f 100644 --- a/spec/controllers/projects/branches_controller_spec.rb +++ b/spec/controllers/projects/branches_controller_spec.rb @@ -113,22 +113,38 @@ describe Projects::BranchesController do expect(response).to redirect_to project_tree_path(project, branch) end - it 'redirects to autodeploy setup page' do - result = { status: :success, branch: double(name: branch) } + shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do + it 'redirects to autodeploy setup page' do + result = { status: :success, branch: double(name: branch) } + + expect_any_instance_of(CreateBranchService).to receive(:execute).and_return(result) + expect(SystemNoteService).to receive(:new_issue_branch).and_return(true) + + post :create, + namespace_id: project.namespace.to_param, + project_id: project.to_param, + branch_name: branch, + issue_iid: issue.iid + + expect(response.location).to include(project_new_blob_path(project, branch)) + expect(response).to have_gitlab_http_status(302) + end + end - project.services << build(:kubernetes_service) + context 'when user configured kubernetes from Integration > Kubernetes' do + before do + project.services << build(:kubernetes_service) + end - expect_any_instance_of(CreateBranchService).to receive(:execute).and_return(result) - expect(SystemNoteService).to receive(:new_issue_branch).and_return(true) + it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes' + end - post :create, - namespace_id: project.namespace.to_param, - project_id: project.to_param, - branch_name: branch, - issue_iid: issue.iid + context 'when user configured kubernetes from CI/CD > Clusters' do + before do + create(:cluster, :provided_by_gcp, projects: [project]) + end - expect(response.location).to include(project_new_blob_path(project, branch)) - expect(response).to have_gitlab_http_status(302) + it_behaves_like 'same behavior between KubernetesService and Platform::Kubernetes' end end |
