diff options
Diffstat (limited to 'spec/workers/web_hook_worker_spec.rb')
-rw-r--r-- | spec/workers/web_hook_worker_spec.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/workers/web_hook_worker_spec.rb b/spec/workers/web_hook_worker_spec.rb index bbb8844a447..dbdf7a2b978 100644 --- a/spec/workers/web_hook_worker_spec.rb +++ b/spec/workers/web_hook_worker_spec.rb @@ -19,7 +19,16 @@ RSpec.describe WebHookWorker do expect { subject.perform(non_existing_record_id, data, hook_name) }.not_to raise_error end - it 'retrieves recursion detection data, reinstates it, and cleans it from payload', :request_store, :aggregate_failures do + it 'retrieves recursion detection data and reinstates it', :request_store, :aggregate_failures do + uuid = SecureRandom.uuid + params = { recursion_detection_request_uuid: uuid } + + expect_next(WebHookService, project_hook, data.with_indifferent_access, hook_name, anything).to receive(:execute) + expect { subject.perform(project_hook.id, data, hook_name, params) } + .to change { Gitlab::WebHooks::RecursionDetection::UUID.instance.request_uuid }.to(uuid) + end + + it 'retrieves recursion detection data, reinstates it, and cleans it from payload when passed through as data', :request_store, :aggregate_failures do uuid = SecureRandom.uuid full_data = data.merge({ _gitlab_recursion_detection_request_uuid: uuid }) |