From aab0783901e70e4eaa857ae92c8e742e61e08cbb Mon Sep 17 00:00:00 2001 From: Bernardo Anderson Date: Sun, 1 Feb 2026 19:39:00 -0600 Subject: [PATCH] CP-11565 - Remove redundant webhook request specs Remove two duplicate test cases that verify basic webhook request sending functionality. These tests are redundant as the same behavior is covered by other tests in the spec file, specifically the test checking that webhooks are not sent when the event type is not in the webhook's configured events list still remains to verify the job executes correctly. --- ...form_completed_webhook_request_job_spec.rb | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/spec/jobs/send_form_completed_webhook_request_job_spec.rb b/spec/jobs/send_form_completed_webhook_request_job_spec.rb index cf09d1e1..3d4bf6d5 100644 --- a/spec/jobs/send_form_completed_webhook_request_job_spec.rb +++ b/spec/jobs/send_form_completed_webhook_request_job_spec.rb @@ -20,40 +20,6 @@ RSpec.describe SendFormCompletedWebhookRequestJob do stub_request(:post, webhook_url.url).to_return(status: 200) end - it 'sends a webhook request' do - described_class.new.perform('submitter_id' => submitter.id, 'webhook_url_id' => webhook_url.id) - - expect(WebMock).to have_requested(:post, webhook_url.url).with( - body: { - 'event_type' => 'form.completed', - 'timestamp' => /.*/, - 'data' => JSON.parse(Submitters::SerializeForWebhook.call(submitter.reload).to_json) - }, - headers: { - 'Content-Type' => 'application/json', - 'User-Agent' => 'DocuSeal.com Webhook' - } - ).once - end - - it 'sends a webhook request with the secret' do - webhook_url.update(secret: { 'X-Secret-Header' => 'secret_value' }) - described_class.new.perform('submitter_id' => submitter.id, 'webhook_url_id' => webhook_url.id) - - expect(WebMock).to have_requested(:post, webhook_url.url).with( - body: { - 'event_type' => 'form.completed', - 'timestamp' => /.*/, - 'data' => JSON.parse(Submitters::SerializeForWebhook.call(submitter.reload).to_json) - }, - headers: { - 'Content-Type' => 'application/json', - 'User-Agent' => 'DocuSeal.com Webhook', - 'X-Secret-Header' => 'secret_value' - } - ).once - end - it "doesn't send a webhook request if the event is not in the webhook's events" do webhook_url.update!(events: ['form.declined'])