2021-06-08 01:23:25 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe WebHookWorker do
|
|
|
|
include AfterNextHelpers
|
|
|
|
|
|
|
|
let_it_be(:project_hook) { create(:project_hook) }
|
|
|
|
let_it_be(:data) { { foo: 'bar' } }
|
|
|
|
let_it_be(:hook_name) { 'push_hooks' }
|
|
|
|
|
|
|
|
describe '#perform' do
|
|
|
|
it 'delegates to WebHookService' do
|
2021-09-04 01:27:46 +05:30
|
|
|
expect_next(WebHookService, project_hook, data.with_indifferent_access, hook_name, anything).to receive(:execute)
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
subject.perform(project_hook.id, data, hook_name)
|
|
|
|
end
|
2021-09-04 01:27:46 +05:30
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
it 'does not error when the WebHook record cannot be found' do
|
|
|
|
expect { subject.perform(non_existing_record_id, data, hook_name) }.not_to raise_error
|
|
|
|
end
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
it_behaves_like 'worker with data consistency',
|
|
|
|
described_class,
|
|
|
|
data_consistency: :delayed
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
|
|
|
end
|