feat: Mark the messages as failed if the API channel webhooks fail for any reason. (#8277)

This commit is contained in:
Muhsin Keloth
2023-11-04 12:26:28 +05:30
committed by GitHub
parent 3b84b0fc47
commit b4d20689b7
7 changed files with 129 additions and 21 deletions

View File

@@ -3,19 +3,20 @@ require 'rails_helper'
RSpec.describe AgentBots::WebhookJob do
include ActiveJob::TestHelper
subject(:job) { described_class.perform_later(url, payload) }
subject(:job) { described_class.perform_later(url, payload, webhook_type) }
let(:url) { 'https://test.com' }
let(:payload) { { name: 'test' } }
let(:webhook_type) { :agent_bot_webhook }
it 'queues the job' do
expect { job }.to have_enqueued_job(described_class)
.with(url, payload)
.with(url, payload, webhook_type)
.on_queue('high')
end
it 'executes perform' do
expect(Webhooks::Trigger).to receive(:execute).with(url, payload)
expect(Webhooks::Trigger).to receive(:execute).with(url, payload, webhook_type)
perform_enqueued_jobs { job }
end
end