Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_push.rb « repository « resource « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d0e94951f3b5c5a9ff283ec90bd69629b36318d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# frozen_string_literal: true

module QA
  module Resource
    module Repository
      class ProjectPush < Repository::Push
        attr_accessor :project_name
        attr_writer :wait_for_push

        attribute :group

        attribute :project do
          Project.fabricate! do |resource|
            resource.group = group if @group
            resource.name = project_name
            resource.description = 'Project with repository'
          end
        end

        def initialize
          @file_name = "file-#{SecureRandom.hex(8)}.txt"
          @file_content = '# This is test project'
          @commit_message = "This is a test commit"
          @new_branch = true
          @project_name = 'project-with-code'
          @wait_for_push = true
          @group = nil
        end

        def repository_http_uri
          @repository_http_uri ||= project.repository_http_location.uri
        end

        def repository_ssh_uri
          @repository_ssh_uri ||= project.repository_ssh_location.uri
        end

        def fabricate!
          @branch_name ||= project.default_branch

          super
          project.wait_for_push @commit_message if @wait_for_push
        end
      end
    end
  end
end