2018-07-18 16:03:33 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-20 15:12:06 +00:00
|
|
|
module TestHooks
|
|
|
|
class SystemService < TestHooks::BaseService
|
|
|
|
private
|
|
|
|
|
|
|
|
def push_events_data
|
2017-08-27 21:43:42 +00:00
|
|
|
Gitlab::DataBuilder::Push.sample_data
|
2017-07-20 15:12:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def tag_push_events_data
|
2017-08-27 21:43:42 +00:00
|
|
|
Gitlab::DataBuilder::Push.sample_data
|
2017-07-20 15:12:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def repository_update_events_data
|
2017-08-27 21:43:42 +00:00
|
|
|
Gitlab::DataBuilder::Repository.sample_data
|
2017-07-20 15:12:06 +00:00
|
|
|
end
|
2017-09-20 08:41:43 +00:00
|
|
|
|
|
|
|
def merge_requests_events_data
|
|
|
|
merge_request = MergeRequest.of_projects(current_user.projects.select(:id)).first
|
2019-04-15 12:25:48 +00:00
|
|
|
throw(:validation_error, s_('TestHooks|Ensure one of your projects has merge requests.')) unless merge_request.present?
|
2017-09-20 08:41:43 +00:00
|
|
|
|
|
|
|
merge_request.to_hook_data(current_user)
|
|
|
|
end
|
2017-07-20 15:12:06 +00:00
|
|
|
end
|
|
|
|
end
|