blob: b4295a352630a6acef701a653ed187074d1719a8 (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# frozen_string_literal: true
require 'securerandom'
module QA
module Resource
class Issue < Base
attr_writer :description, :milestone, :weight
attribute :project do
Project.fabricate! do |resource|
resource.name = 'project-for-issues'
resource.description = 'project for adding issues'
end
end
attribute :id
attribute :iid
attribute :assignee_ids
attribute :labels
attribute :title
def initialize
@assignee_ids = []
@labels = []
@title = "Issue title #{SecureRandom.hex(8)}"
end
def fabricate!
project.visit!
Page::Project::Show.perform(&:go_to_new_issue)
Page::Project::Issue::New.perform do |new_page|
new_page.fill_title(@title)
new_page.fill_description(@description)
new_page.create_new_issue
end
end
def api_get_path
"/projects/#{project.id}/issues/#{id}"
end
def api_post_path
"/projects/#{project.id}/issues"
end
def api_post_body
{
assignee_ids: assignee_ids,
labels: labels,
title: title
}.tap do |hash|
hash[:milestone_id] = @milestone.id if @milestone
hash[:weight] = @weight if @weight
end
end
end
end
end
|