Commit 759bcf35 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch 'add_spec_for_execute_services' into 'master'

Add spec for project#execute_services

See merge request gitlab-org/gitlab!33180
parents 7848e6eb 81e0e2b0
......@@ -4812,6 +4812,32 @@ describe Project do
end
end
describe '#execute_services' do
let(:service) { create(:slack_service, push_events: true, merge_requests_events: false, active: true) }
it 'executes services with the specified scope' do
data = 'any data'
expect(SlackService).to receive(:allocate).and_wrap_original do |method|
method.call.tap do |instance|
expect(instance).to receive(:async_execute).with(data).once
end
end
service.project.execute_services(data, :push_hooks)
end
it 'does not execute services that don\'t match the specified scope' do
expect(SlackService).not_to receive(:allocate).and_wrap_original do |method|
method.call.tap do |instance|
expect(instance).not_to receive(:async_execute)
end
end
service.project.execute_services(anything, :merge_request_hooks)
end
end
describe '#has_active_hooks?' do
let_it_be(:project) { create(:project) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment