system_service.rb 635 字节
Newer Older
1 2 3 4 5
module TestHooks
  class SystemService < TestHooks::BaseService
    private

    def push_events_data
6
      Gitlab::DataBuilder::Push.sample_data
7 8 9
    end

    def tag_push_events_data
10
      Gitlab::DataBuilder::Push.sample_data
11 12 13
    end

    def repository_update_events_data
14
      Gitlab::DataBuilder::Repository.sample_data
15
    end
16 17 18 19 20 21 22

    def merge_requests_events_data
      merge_request = MergeRequest.of_projects(current_user.projects.select(:id)).first
      throw(:validation_error, 'Ensure one of your projects has merge requests.') unless merge_request.present?

      merge_request.to_hook_data(current_user)
    end
23 24
  end
end