delivery_worker_spec.rb 596 B

12345678910111213141516171819202122232425
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Webhooks::DeliveryWorker do
  4. let(:worker) { described_class.new }
  5. describe '#perform' do
  6. let(:webhook) { Fabricate(:webhook) }
  7. it 'reprocesses and updates the webhook' do
  8. stub_request(:post, webhook.url).to_return(status: 200, body: '')
  9. worker.perform(webhook.id, 'body')
  10. expect(a_request(:post, webhook.url)).to have_been_made.at_least_once
  11. end
  12. it 'returns true for non-existent record' do
  13. result = worker.perform(123_123_123, '')
  14. expect(result).to be(true)
  15. end
  16. end
  17. end