summaryrefslogtreecommitdiff
path: root/qa/qa/resource/project_milestone.rb
blob: 4d6b37937b4584bf73659ec262090cc1a12a529f (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
# frozen_string_literal: true

module QA
  module Resource
    class ProjectMilestone < Base
      attribute :id
      attribute :title

      attribute :project do
        Project.fabricate_via_api! do |resource|
          resource.name = 'project-with-milestone'
        end
      end

      def initialize
        @title = "project-milestone-#{SecureRandom.hex(4)}"
      end

      def api_get_path
        "/projects/#{project.id}/milestones/#{id}"
      end

      def api_post_path
        "/projects/#{project.id}/milestones"
      end

      def api_post_body
        {
          title: title
        }
      end
    end
  end
end