Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 12:09:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 12:09:09 +0300
commitc384315ae1ea48df2a741874b326581ded0a97e1 (patch)
tree6f50dfdb7fb726ef3e738dc5264526cf683906a3 /spec/lib/gitlab/ci
parente1e017ddc4d64e4777bbe663c555093a7ae0cca3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/ci')
-rw-r--r--spec/lib/gitlab/ci/templates/managed_cluster_applications_gitlab_ci_yaml_spec.rb39
1 files changed, 39 insertions, 0 deletions
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