BigW Consortium Gitlab

Commit b22ae0c0 by Alexis Reigel Committed by Alexis Reigel

invoke SystemHooksService instead of direct model

parent 9f7811e4
......@@ -975,9 +975,7 @@ class Project < ActiveRecord::Base
end
end
SystemHook.public_send(hooks_scope).each do |hook| # rubocop:disable GitlabSecurity/PublicSend
hook.async_execute(data, hooks_scope.to_s)
end
SystemHooksService.new.execute_hooks(data, hooks_scope)
end
def execute_services(data, hooks_scope = :push_hooks)
......
......@@ -3190,14 +3190,10 @@ describe Project do
end
it 'executes the system hooks with the specified scope' do
create :system_hook, merge_requests_events: true, tag_push_events: false
create :system_hook, merge_requests_events: false, tag_push_events: true
allow_any_instance_of(SystemHook).to receive(:async_execute).once
project = create :project
expect_any_instance_of(SystemHooksService).to receive(:execute_hooks).with({ data: 'data' }, :merge_request_hooks)
expect_any_instance_of(SystemHook).to receive(:async_execute).once
project.execute_hooks({}, :tag_push_hooks)
project = build(:project)
project.execute_hooks({ data: 'data' }, :merge_request_hooks)
end
end
end
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