Commit 2b6461bf authored by Shinya Maeda's avatar Shinya Maeda

Add a spec for dupcalite merge request pipeline creation case

This is EE related change
parent b5cb6123
...@@ -182,5 +182,46 @@ describe MergeRequests::RefreshService do ...@@ -182,5 +182,46 @@ describe MergeRequests::RefreshService do
end end
end end
end end
describe 'Pipelines for merge requests' do
let(:service) { described_class.new(project, current_user) }
let(:current_user) { merge_request.author }
let(:config) do
{
test: {
stage: 'test',
script: 'echo',
only: ['merge_requests']
}
}
end
before do
project.add_developer(current_user)
project.update(merge_pipelines_enabled: true)
stub_licensed_features(merge_pipelines: true)
stub_ci_pipeline_yaml_file(YAML.dump(config))
end
it 'creates a merge request pipeline' do
expect { subject }
.to change { merge_request.pipelines_for_merge_request.count }.by(1)
expect(merge_request.all_pipelines.last).to be_merge_request_pipeline
end
context "when MergeRequestUpdateWorker is retried by an exception" do
it 'does not re-create a duplicate merge request pipeline' do
expect do
service.execute(oldrev, newrev, "refs/heads/#{source_branch}")
end.to change { merge_request.pipelines_for_merge_request.count }.by(1)
expect do
service.execute(oldrev, newrev, "refs/heads/#{source_branch}")
end.not_to change { merge_request.pipelines_for_merge_request.count }
end
end
end
end end
end end
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