1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Add basic coverage for WebhookService class (#29331)

This commit is contained in:
Matt Jankowski 2024-02-22 05:46:20 -05:00 committed by GitHub
parent d1602c017d
commit a69fe534e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,30 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe WebhookService do
describe '#call' do
context 'with a relevant event webhook' do
let!(:report) { Fabricate(:report) }
let!(:webhook) { Fabricate(:webhook, events: ['report.created']) }
it 'finds and delivers webhook payloads' do
expect { subject.call('report.created', report) }
.to enqueue_sidekiq_job(Webhooks::DeliveryWorker)
.with(
webhook.id,
anything
)
end
end
context 'without any relevant event webhooks' do
let!(:report) { Fabricate(:report) }
it 'does not deliver webhook payloads' do
expect { subject.call('report.created', report) }
.to_not enqueue_sidekiq_job(Webhooks::DeliveryWorker)
end
end
end
end