Commit 338c7b31 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'process-when-auto-merge-is-enabled' into 'master'

Notify events when auto merge is enabled or merge param is updated

See merge request gitlab-org/gitlab-ce!29415
parents 641d3323 8f243acf
...@@ -14,6 +14,9 @@ module AutoMerge ...@@ -14,6 +14,9 @@ module AutoMerge
yield if block_given? yield if block_given?
# Notify the event that auto merge is enabled or merge param is updated
AutoMergeProcessWorker.perform_async(merge_request.id)
strategy.to_sym strategy.to_sym
end end
......
...@@ -12,6 +12,10 @@ describe AutoMerge::BaseService do ...@@ -12,6 +12,10 @@ describe AutoMerge::BaseService do
describe '#execute' do describe '#execute' do
subject { service.execute(merge_request) } subject { service.execute(merge_request) }
before do
allow(AutoMergeProcessWorker).to receive(:perform_async) {}
end
it 'sets properies to the merge request' do it 'sets properies to the merge request' do
subject subject
...@@ -65,6 +69,12 @@ describe AutoMerge::BaseService do ...@@ -65,6 +69,12 @@ describe AutoMerge::BaseService do
it 'returns activated strategy name' do it 'returns activated strategy name' do
is_expected.to eq(AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS.to_sym) is_expected.to eq(AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS.to_sym)
end end
it 'calls AutoMergeProcessWorker' do
expect(AutoMergeProcessWorker).to receive(:perform_async).with(merge_request.id).once
subject
end
end end
context 'when failed to save' do context 'when failed to save' do
......
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