diff --git a/ee/spec/lib/gitlab/ci/templates/dast_gitlab_ci_yaml_spec.rb b/ee/spec/lib/gitlab/ci/templates/dast_gitlab_ci_yaml_spec.rb index de4bca0b56115f2f32fa801c91cb235f3936b0e9..6a065608d56fee1729a0b8372e316fc4693ba2d4 100644 --- a/ee/spec/lib/gitlab/ci/templates/dast_gitlab_ci_yaml_spec.rb +++ b/ee/spec/lib/gitlab/ci/templates/dast_gitlab_ci_yaml_spec.rb @@ -6,7 +6,7 @@ subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('DAST') } describe 'the created pipeline' do - let(:default_branch) { 'master' } + let(:default_branch) { project.default_branch_or_main } let(:pipeline_branch) { default_branch } let(:project) { create(:project, :custom_repo, files: { 'README.txt' => '' }) } let(:user) { project.owner } @@ -107,7 +107,7 @@ let(:pipeline_branch) { 'patch-1' } before do - project.repository.create_branch(pipeline_branch) + project.repository.create_branch(pipeline_branch, default_branch) end it 'includes dast job' do @@ -133,7 +133,7 @@ let(:pipeline_branch) { 'patch-1' } before do - project.repository.create_branch(pipeline_branch) + project.repository.create_branch(pipeline_branch, default_branch) end it 'includes no jobs' do diff --git a/ee/spec/lib/gitlab/ci/templates/dast_latest_gitlab_ci_yaml_spec.rb b/ee/spec/lib/gitlab/ci/templates/dast_latest_gitlab_ci_yaml_spec.rb index 3984905d9ae9c046986fca7d8af061d2c8bdff08..64110bf92d9cd97c41a364c5eaef5141fba2a002 100644 --- a/ee/spec/lib/gitlab/ci/templates/dast_latest_gitlab_ci_yaml_spec.rb +++ b/ee/spec/lib/gitlab/ci/templates/dast_latest_gitlab_ci_yaml_spec.rb @@ -18,7 +18,7 @@ subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('DAST.latest') } describe 'the created pipeline' do - let(:default_branch) { 'master' } + let(:default_branch) { project.default_branch_or_main } let(:pipeline_branch) { default_branch } let(:project) { create(:project, :custom_repo, files: { 'README.txt' => '' }) } let(:user) { project.owner } @@ -143,7 +143,7 @@ let(:pipeline_branch) { 'patch-1' } before do - project.repository.create_branch(pipeline_branch) + project.repository.create_branch(pipeline_branch, default_branch) end it 'includes dast job' do @@ -167,7 +167,7 @@ let(:pipeline_branch) { 'patch-1' } before do - project.repository.create_branch(pipeline_branch) + project.repository.create_branch(pipeline_branch, default_branch) end include_examples 'includes no jobs' diff --git a/spec/lib/gitlab/ci/templates/AWS/deploy_ecs_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/AWS/deploy_ecs_gitlab_ci_yaml_spec.rb index 653b3be0b2ab06c7c9146d1d1d630db2a41c3c22..e8aeb93a2ba3e082336af260b525207745feabc7 100644 --- a/spec/lib/gitlab/ci/templates/AWS/deploy_ecs_gitlab_ci_yaml_spec.rb +++ b/spec/lib/gitlab/ci/templates/AWS/deploy_ecs_gitlab_ci_yaml_spec.rb @@ -6,7 +6,7 @@ subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('AWS/Deploy-ECS') } describe 'the created pipeline' do - let(:default_branch) { 'master' } + let(:default_branch) { project.default_branch_or_main } let(:pipeline_branch) { default_branch } let(:project) { create(:project, :auto_devops, :custom_repo, files: { 'README.md' => '' }) } let(:user) { project.owner } @@ -38,7 +38,7 @@ let(:pipeline_branch) { 'test_branch' } before do - project.repository.create_branch(pipeline_branch) + project.repository.create_branch(pipeline_branch, default_branch) end it_behaves_like 'no pipeline yaml error' 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 index 0e458e01a2c3c36ad2ede26bdcfad9a195e4b43d..151880e27a39aeba4b82203c6308bf8a07dd7e9a 100644 --- 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 @@ -12,7 +12,8 @@ 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' } + let(:default_branch) { project.default_branch_or_main } + let(:pipeline_branch) { default_branch } before do stub_ci_pipeline_yaml_file(template.content) @@ -28,7 +29,7 @@ let(:pipeline_branch) { 'a_branch' } before do - project.repository.create_branch(pipeline_branch) + project.repository.create_branch(pipeline_branch, default_branch) end it 'has no jobs' do diff --git a/spec/lib/gitlab/ci/templates/terraform_latest_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/terraform_latest_gitlab_ci_yaml_spec.rb index 4377f155d345ced32f523313aa166cba57ddfee5..5ab3035486f68285e6f87091efb73f8b81bfa45a 100644 --- a/spec/lib/gitlab/ci/templates/terraform_latest_gitlab_ci_yaml_spec.rb +++ b/spec/lib/gitlab/ci/templates/terraform_latest_gitlab_ci_yaml_spec.rb @@ -10,7 +10,7 @@ subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('Terraform.latest') } describe 'the created pipeline' do - let(:default_branch) { 'master' } + let(:default_branch) { project.default_branch_or_main } let(:pipeline_branch) { default_branch } let(:project) { create(:project, :custom_repo, files: { 'README.md' => '' }) } let(:user) { project.owner } @@ -34,7 +34,7 @@ let(:pipeline_branch) { 'patch-1' } before do - project.repository.create_branch(pipeline_branch) + project.repository.create_branch(pipeline_branch, default_branch) end it 'does not creates a deploy and a test job' do