Commit dc91d10c authored by Gary Holtz's avatar Gary Holtz

Creates an actual idempotency spec

parent 811e5eef
......@@ -4,6 +4,10 @@ module MergeRequests
class SquashService < MergeRequests::BaseService
include Git::Logger
def idempotent?
true
end
def execute
# If performing a squash would result in no change, then
# immediately return a success message without performing a squash
......
......@@ -140,6 +140,13 @@ describe MergeRequests::SquashService do
context 'when the merge request has already been merged' do
let(:merge_request) { merge_request_with_one_commit }
it 'checks the side-effects for multiple calls' do
merge_request.mark_as_merged
expect(service).to be_idempotent
expect { IdempotentWorkerHelper::WORKER_EXEC_TIMES.times { service.execute } }.not_to raise_error
end
it 'idempotently returns a success' do
merge_request.mark_as_merged
result = service.execute
......
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