chore: Move Facebook event processing to worker (#2988)
This commit is contained in:
27
spec/jobs/webhooks/facebook_events_job_spec.rb
Normal file
27
spec/jobs/webhooks/facebook_events_job_spec.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Webhooks::FacebookEventsJob, type: :job do
|
||||
subject(:job) { described_class.perform_later(params) }
|
||||
|
||||
let!(:params) { { test: 'test' } }
|
||||
|
||||
it 'enqueues the job' do
|
||||
expect { job }.to have_enqueued_job(described_class)
|
||||
.with(params)
|
||||
.on_queue('default')
|
||||
end
|
||||
|
||||
context 'when called with params' do
|
||||
it 'calls MessagePArsed and do message create' do
|
||||
parser = double
|
||||
creator = double
|
||||
allow(::Integrations::Facebook::MessageParser).to receive(:new).and_return(parser)
|
||||
allow(::Integrations::Facebook::MessageCreator).to receive(:new).and_return(creator)
|
||||
allow(creator).to receive(:perform).and_return(true)
|
||||
expect(::Integrations::Facebook::MessageParser).to receive(:new).with(params)
|
||||
expect(::Integrations::Facebook::MessageCreator).to receive(:new).with(parser)
|
||||
expect(creator).to receive(:perform)
|
||||
described_class.perform_now(params)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user