adjust webhooks

This commit is contained in:
Pete Matsyburka
2024-11-01 15:35:02 +02:00
parent 84edb6dbda
commit 2542f26d96
40 changed files with 156 additions and 235 deletions
@@ -52,14 +52,6 @@ RSpec.describe SendTemplateCreatedWebhookRequestJob do
).once
end
it "doesn't send a webhook request if the template doesn't exist" do
expect do
described_class.new.perform('template_id' => 100_500, 'webhook_url_id' => webhook_url.id)
end.to raise_error ActiveRecord::RecordNotFound
expect(WebMock).not_to have_requested(:post, webhook_url.url)
end
it "doesn't send a webhook request if the event is not in the webhook's events" do
webhook_url.update!(events: ['template.updated'])
@@ -68,12 +60,6 @@ RSpec.describe SendTemplateCreatedWebhookRequestJob do
expect(WebMock).not_to have_requested(:post, webhook_url.url)
end
it "doesn't send a webhook request if the webhook doesn't exist" do
described_class.new.perform('template_id' => template.id, 'webhook_url_id' => 100_500)
expect(WebMock).not_to have_requested(:post, webhook_url.url)
end
it 'sends again if the response status is 400 or higher' do
stub_request(:post, webhook_url.url).to_return(status: 401)