Skip to content

Commit

Permalink
Add spec coverage for Webhooks::DeliveryWorker
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski committed Nov 15, 2023
1 parent 60a815e commit 4fc7b9e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions spec/workers/webhooks/delivery_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@

require 'rails_helper'

describe Webhooks::DeliveryWorker do
describe Webhooks::DeliveryWorker, :paperclip_processing do
let(:worker) { described_class.new }

describe 'perform' do
it 'runs without error' do
expect { worker.perform(nil, nil) }.to_not raise_error
describe '#perform' do
let(:webhook) { Fabricate(:webhook) }

it 'reprocesses and updates the media attachment' do
stub_request(:post, webhook.url).to_return(status: 200, body: '')

worker.perform(webhook.id, 'body')

expect(a_request(:post, webhook.url)).to have_been_made.at_least_once
end

it 'returns true for non-existent record' do
result = worker.perform(123_123_123, '')

expect(result).to be(true)
end
end
end

0 comments on commit 4fc7b9e

Please sign in to comment.