blob: 151880e27a39aeba4b82203c6308bf8a07dd7e9a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.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(:default_branch) { project.default_branch_or_main }
let(:pipeline_branch) { default_branch }
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, default_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
|