Commit 75cc6b3d authored by Stan Hu's avatar Stan Hu

Merge branch 'add-test-prevent-regression-mr-pipelines-with-approvals' into 'master'

Add test to prevent regression on MR pipeline creation

See merge request gitlab-org/gitlab!84681
parents bb34d91d ac33dfcf
...@@ -40,7 +40,7 @@ RSpec.describe MergeRequests::CreatePipelineService, :clean_gitlab_redis_shared_ ...@@ -40,7 +40,7 @@ RSpec.describe MergeRequests::CreatePipelineService, :clean_gitlab_redis_shared_
source_project.add_developer(user) source_project.add_developer(user)
target_project.add_developer(user) target_project.add_developer(user)
source_project.merge_pipelines_enabled = merge_pipelines_enabled source_project.merge_pipelines_enabled = merge_pipelines_enabled
stub_licensed_features(merge_pipelines: merge_pipelines_license) stub_licensed_features(merge_pipelines: merge_pipelines_license, multiple_approval_rules: true)
stub_ci_pipeline_yaml_file(ci_yaml) stub_ci_pipeline_yaml_file(ci_yaml)
end end
...@@ -80,6 +80,21 @@ RSpec.describe MergeRequests::CreatePipelineService, :clean_gitlab_redis_shared_ ...@@ -80,6 +80,21 @@ RSpec.describe MergeRequests::CreatePipelineService, :clean_gitlab_redis_shared_
it_behaves_like 'detached merge request pipeline' it_behaves_like 'detached merge request pipeline'
end end
context 'when merge request requires an approval' do
before do
create(:approval_merge_request_rule, merge_request: merge_request, users: [user], name: 'some-custom-rule',
approvals_required: 1)
end
it 'creates a merge request pipeline' do
subject
expect(merge_request.all_pipelines.count).to eq(1)
expect(merge_request.all_pipelines.last).to be_merged_result_pipeline
expect(merge_request.all_pipelines.last).not_to be_detached_merge_request_pipeline
end
end
context 'when project setting for merge request pipelines is disabled' do context 'when project setting for merge request pipelines is disabled' do
let(:merge_pipelines_enabled) { false } let(:merge_pipelines_enabled) { false }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment