diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 12:09:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 12:09:09 +0300 |
commit | c384315ae1ea48df2a741874b326581ded0a97e1 (patch) | |
tree | 6f50dfdb7fb726ef3e738dc5264526cf683906a3 /spec | |
parent | e1e017ddc4d64e4777bbe663c555093a7ae0cca3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/dev_ops_score_metrics.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/templates/managed_cluster_applications_gitlab_ci_yaml_spec.rb | 39 | ||||
-rw-r--r-- | spec/models/dev_ops_score/metric_spec.rb (renamed from spec/models/conversational_development_index/metric_spec.rb) | 2 | ||||
-rw-r--r-- | spec/presenters/dev_ops_score/metric_presenter_spec.rb (renamed from spec/presenters/conversational_development_index/metric_presenter_spec.rb) | 2 | ||||
-rw-r--r-- | spec/routing/environments_spec.rb | 4 | ||||
-rw-r--r-- | spec/routing/project_routing_spec.rb | 24 | ||||
-rw-r--r-- | spec/serializers/cluster_basic_entity_spec.rb | 2 | ||||
-rw-r--r-- | spec/serializers/environment_status_entity_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/submit_usage_ping_service_spec.rb | 8 |
9 files changed, 74 insertions, 11 deletions
diff --git a/spec/factories/dev_ops_score_metrics.rb b/spec/factories/dev_ops_score_metrics.rb index a9c592098d4..0d9d7059e7f 100644 --- a/spec/factories/dev_ops_score_metrics.rb +++ b/spec/factories/dev_ops_score_metrics.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true FactoryBot.define do - factory :dev_ops_score_metric, class: ConversationalDevelopmentIndex::Metric do + factory :dev_ops_score_metric, class: DevOpsScore::Metric do leader_issues { 9.256 } instance_issues { 1.234 } percentage_issues { 13.331 } diff --git a/spec/lib/gitlab/ci/templates/managed_cluster_applications_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/managed_cluster_applications_gitlab_ci_yaml_spec.rb new file mode 100644 index 00000000000..2a6314755ef --- /dev/null +++ b/spec/lib/gitlab/ci/templates/managed_cluster_applications_gitlab_ci_yaml_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'Managed-Cluster-Applications.gitlab-ci.yml' do + subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('Managed-Cluster-Applications') } + + describe 'the created pipeline' do + let_it_be(:user) { create(:user) } + + let(:project) { create(:project, :custom_repo, namespace: user.namespace, files: { 'README.md' => '' }) } + let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) } + let(:pipeline) { service.execute!(:push) } + let(:build_names) { pipeline.builds.pluck(:name) } + let(:pipeline_branch) { 'master' } + + before do + stub_ci_pipeline_yaml_file(template.content) + end + + context 'for a default branch' do + it 'creates a apply job' do + expect(build_names).to match_array('apply') + end + end + + context 'outside of default branch' do + let(:pipeline_branch) { 'a_branch' } + + before do + project.repository.create_branch(pipeline_branch) + end + + it 'has no jobs' do + expect { pipeline }.to raise_error(Ci::CreatePipelineService::CreateError, 'No stages / jobs for this pipeline.') + end + end + end +end diff --git a/spec/models/conversational_development_index/metric_spec.rb b/spec/models/dev_ops_score/metric_spec.rb index 3f88236f8c4..89212d5ca26 100644 --- a/spec/models/conversational_development_index/metric_spec.rb +++ b/spec/models/dev_ops_score/metric_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ConversationalDevelopmentIndex::Metric do +describe DevOpsScore::Metric do let(:conv_dev_index) { create(:dev_ops_score_metric) } describe '#percentage_score' do diff --git a/spec/presenters/conversational_development_index/metric_presenter_spec.rb b/spec/presenters/dev_ops_score/metric_presenter_spec.rb index 857b23656bb..b6eab3f2e74 100644 --- a/spec/presenters/conversational_development_index/metric_presenter_spec.rb +++ b/spec/presenters/dev_ops_score/metric_presenter_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ConversationalDevelopmentIndex::MetricPresenter do +describe DevOpsScore::MetricPresenter do subject { described_class.new(metric) } let(:metric) { build(:dev_ops_score_metric) } diff --git a/spec/routing/environments_spec.rb b/spec/routing/environments_spec.rb index ea172698764..46d4f31dd31 100644 --- a/spec/routing/environments_spec.rb +++ b/spec/routing/environments_spec.rb @@ -11,7 +11,7 @@ describe 'environments routing' do end let(:environments_route) do - "#{project.full_path}/environments/" + "#{project.full_path}/-/environments/" end describe 'routing environment folders' do @@ -38,7 +38,7 @@ describe 'environments routing' do end def get_folder(folder) - get("#{project.full_path}/environments/folders/#{folder}") + get("#{project.full_path}/-/environments/folders/#{folder}") end def folder_action(**opts) diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index 561c2b572ec..fc562f93406 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -794,4 +794,28 @@ describe 'project routing' do expect(post('/gitlab/gitlabhq/usage_ping/web_ide_clientside_preview')).to route_to('projects/usage_ping#web_ide_clientside_preview', namespace_id: 'gitlab', project_id: 'gitlabhq') end end + + describe Projects::EnvironmentsController, 'routing' do + describe 'legacy routing' do + it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/environments", "/gitlab/gitlabhq/-/environments" + end + end + + describe Projects::ClustersController, 'routing' do + describe 'legacy routing' do + it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/clusters", "/gitlab/gitlabhq/-/clusters" + end + end + + describe Projects::ErrorTrackingController, 'routing' do + describe 'legacy routing' do + it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/error_tracking", "/gitlab/gitlabhq/-/error_tracking" + end + end + + describe Projects::Serverless, 'routing' do + describe 'legacy routing' do + it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/serverless", "/gitlab/gitlabhq/-/serverless" + end + end end diff --git a/spec/serializers/cluster_basic_entity_spec.rb b/spec/serializers/cluster_basic_entity_spec.rb index be03ee91784..8c3307a1837 100644 --- a/spec/serializers/cluster_basic_entity_spec.rb +++ b/spec/serializers/cluster_basic_entity_spec.rb @@ -24,7 +24,7 @@ describe ClusterBasicEntity do it 'exposes the cluster details' do expect(subject[:name]).to eq('the-cluster') - expect(subject[:path]).to eq("/#{project.full_path}/clusters/#{cluster.id}") + expect(subject[:path]).to eq("/#{project.full_path}/-/clusters/#{cluster.id}") end context 'when the user does not have permission to view the cluster' do diff --git a/spec/serializers/environment_status_entity_spec.rb b/spec/serializers/environment_status_entity_spec.rb index bac590d44e9..6d98f91cfde 100644 --- a/spec/serializers/environment_status_entity_spec.rb +++ b/spec/serializers/environment_status_entity_spec.rb @@ -73,7 +73,7 @@ describe EnvironmentStatusEntity do it 'returns metrics url' do expect(subject[:metrics_url]) - .to eq("/#{project.full_path}/environments/#{environment.id}/deployments/#{deployment.iid}/metrics") + .to eq("/#{project.full_path}/-/environments/#{environment.id}/deployments/#{deployment.iid}/metrics") end end diff --git a/spec/services/submit_usage_ping_service_spec.rb b/spec/services/submit_usage_ping_service_spec.rb index 653f17a4324..8b68da6674a 100644 --- a/spec/services/submit_usage_ping_service_spec.rb +++ b/spec/services/submit_usage_ping_service_spec.rb @@ -46,12 +46,12 @@ describe SubmitUsagePingService do stub_response(with_conv_index_params) expect { subject.execute } - .to change { ConversationalDevelopmentIndex::Metric.count } + .to change { DevOpsScore::Metric.count } .by(1) - expect(ConversationalDevelopmentIndex::Metric.last.leader_issues).to eq 10.2 - expect(ConversationalDevelopmentIndex::Metric.last.instance_issues).to eq 3.2 - expect(ConversationalDevelopmentIndex::Metric.last.percentage_issues).to eq 31.37 + expect(DevOpsScore::Metric.last.leader_issues).to eq 10.2 + expect(DevOpsScore::Metric.last.instance_issues).to eq 3.2 + expect(DevOpsScore::Metric.last.percentage_issues).to eq 31.37 end end |