Chatwoot/spec/jobs/webhook_job_spec.rb

22 lines
529 B
Ruby
Raw Permalink Normal View History

2020-02-14 17:49:17 +00:00
require 'rails_helper'
RSpec.describe WebhookJob, type: :job do
include ActiveJob::TestHelper
2020-02-14 17:49:17 +00:00
subject(:job) { described_class.perform_later(url, payload) }
let(:url) { 'https://test.chatwoot.com' }
2020-02-14 17:49:17 +00:00
let(:payload) { { name: 'test' } }
it 'queues the job' do
expect { job }.to have_enqueued_job(described_class)
.with(url, payload)
.on_queue('webhooks')
end
it 'executes perform' do
expect(Webhooks::Trigger).to receive(:execute).with(url, payload)
perform_enqueued_jobs { job }
end
2020-02-14 17:49:17 +00:00
end