From 53da3d976f3705a87edc50dca41748b5e479fc83 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Mon, 27 Nov 2017 22:35:16 +0900 Subject: Replce kubernetes_service and deployment_service to deployment_platform --- spec/features/auto_deploy_spec.rb | 59 ++++------------------ .../projects/clusters/interchangeability_spec.rb | 29 ----------- 2 files changed, 11 insertions(+), 77 deletions(-) (limited to 'spec/features') diff --git a/spec/features/auto_deploy_spec.rb b/spec/features/auto_deploy_spec.rb index 327059b86e4..240c5711a7b 100644 --- a/spec/features/auto_deploy_spec.rb +++ b/spec/features/auto_deploy_spec.rb @@ -4,13 +4,7 @@ describe 'Auto deploy' do let(:user) { create(:user) } let(:project) { create(:project, :repository) } - context 'when user configured kubernetes from Integration > Kubernetes' do - before do - create :kubernetes_service, project: project - project.team << [user, :master] - sign_in user - end - + shared_examples 'correct behavior on KubernetesService and Platform::Kubernetes' do context 'when no deployment service is active' do before do project.kubernetes_service.update!(active: false) @@ -55,54 +49,23 @@ describe 'Auto deploy' do end end - context 'when user configured kubernetes from CI/CD > Clusters' do + context 'when user configured kubernetes from Integration > Kubernetes' do before do - create(:cluster, :provided_by_gcp, projects: [project]) + create :kubernetes_service, project: project project.team << [user, :master] sign_in user end - context 'when no deployment service is active' do - before do - project.kubernetes_service.update!(active: false) - end + it_behaves_like 'correct behavior on KubernetesService and Platform::Kubernetes' + end - it 'does not show a button to set up auto deploy' do - visit project_path(project) - expect(page).to have_no_content('Set up auto deploy') - end + context 'when user configured kubernetes from CI/CD > Clusters' do + before do + create(:cluster, :provided_by_gcp, projects: [project]) + project.team << [user, :master] + sign_in user end - context 'when a deployment service is active' do - before do - project.kubernetes_service.update!(active: true) - visit project_path(project) - end - - it 'shows a button to set up auto deploy' do - expect(page).to have_link('Set up auto deploy') - end - - it 'includes OpenShift as an available template', :js do - click_link 'Set up auto deploy' - click_button 'Apply a GitLab CI Yaml template' - - within '.gitlab-ci-yml-selector' do - expect(page).to have_content('OpenShift') - end - end - - it 'creates a merge request using "auto-deploy" branch', :js do - click_link 'Set up auto deploy' - click_button 'Apply a GitLab CI Yaml template' - within '.gitlab-ci-yml-selector' do - click_on 'OpenShift' - end - wait_for_requests - click_button 'Commit changes' - - expect(page).to have_content('New Merge Request From auto-deploy into master') - end - end + it_behaves_like 'correct behavior on KubernetesService and Platform::Kubernetes' end end diff --git a/spec/features/projects/clusters/interchangeability_spec.rb b/spec/features/projects/clusters/interchangeability_spec.rb index b454839e8e2..cf5c0ca347f 100644 --- a/spec/features/projects/clusters/interchangeability_spec.rb +++ b/spec/features/projects/clusters/interchangeability_spec.rb @@ -1,8 +1,6 @@ require 'spec_helper' feature 'Interchangeability between KubernetesService and Platform::Kubernetes' do - let!(:project) { create(:project, :repository) } - EXCEPT_METHODS = %i[test title description help fields initialize_properties namespace namespace= api_url api_url=] EXCEPT_METHODS_GREP_V = %w[_touched? _changed? _was] @@ -15,31 +13,4 @@ feature 'Interchangeability between KubernetesService and Platform::Kubernetes' expect(expected_interfaces - Clusters::Platforms::Kubernetes.instance_methods).to be_empty end - - shared_examples 'selects kubernetes instance' do - context 'when user configured kubernetes from Integration > Kubernetes' do - let!(:kubernetes_service) { create(:kubernetes_service, project: project) } - - it { is_expected.to eq(kubernetes_service) } - end - - context 'when user configured kubernetes from CI/CD > Clusters' do - let!(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } - let(:platform_kubernetes) { cluster.platform_kubernetes } - - it { is_expected.to eq(platform_kubernetes) } - end - end - - describe 'Project#deployment_service' do - subject { project.deployment_service } - - it_behaves_like 'selects kubernetes instance' - end - - describe 'Project#kubernetes_service' do - subject { project.kubernetes_service } - - it_behaves_like 'selects kubernetes instance' - end end -- cgit v1.2.1