Commit 8f243acf authored by Shinya Maeda's avatar Shinya Maeda

Notify when auto merge is enabled

There are bunch of auto merge related notifications, and
when auto merge is enabled, it should be evaluated immediately.
parent a0af3458
...@@ -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