mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-16 06:06:56 +08:00
f68d724202
* Rework experiment permissions [SCI-6054]
25 lines
877 B
Ruby
25 lines
877 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe Activities::DispatchWebhooksJob do
|
|
let!(:activity_filter_1) { create :activity_filter }
|
|
let!(:activity_filter_2) { create :activity_filter }
|
|
let!(:non_matching_activity_filter) do
|
|
create(
|
|
:activity_filter,
|
|
filter: { 'types' => ['163'], 'from_date' => '', 'to_date' => '' }
|
|
)
|
|
end
|
|
let!(:webhook_1) { create :webhook, activity_filter: activity_filter_1 }
|
|
let!(:webhook_2) { create :webhook, activity_filter: activity_filter_2 }
|
|
let!(:webhook_3) { create :webhook, activity_filter: non_matching_activity_filter }
|
|
let(:activity) { create :activity }
|
|
|
|
it 'enqueues webhook jobs' do
|
|
ActiveJob::Base.queue_adapter = :test
|
|
|
|
expect { Activities::DispatchWebhooksJob.new(activity).perform_now }
|
|
.to have_enqueued_job(Activities::SendWebhookJob).exactly(2).times
|
|
end
|
|
end
|