2020-03-05 20:13:12 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2022-06-23 13:47:46 +00:00
|
|
|
RSpec.describe AgentBots::WebhookJob, type: :job do
|
|
|
|
include ActiveJob::TestHelper
|
|
|
|
|
2020-03-05 20:13:12 +00:00
|
|
|
subject(:job) { described_class.perform_later(url, payload) }
|
|
|
|
|
|
|
|
let(:url) { 'https://test.com' }
|
|
|
|
let(:payload) { { name: 'test' } }
|
|
|
|
|
|
|
|
it 'queues the job' do
|
|
|
|
expect { job }.to have_enqueued_job(described_class)
|
|
|
|
.with(url, payload)
|
|
|
|
.on_queue('bots')
|
|
|
|
end
|
2022-06-23 13:47:46 +00:00
|
|
|
|
|
|
|
it 'executes perform' do
|
|
|
|
expect(Webhooks::Trigger).to receive(:execute).with(url, payload)
|
|
|
|
perform_enqueued_jobs { job }
|
|
|
|
end
|
2020-03-05 20:13:12 +00:00
|
|
|
end
|