blob: a68c68c660a9c7159f2c78aeb7c22198c24fa61e (
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
|
# frozen_string_literal: true
module QA
module Resource
class ProjectIssueNote < Base
attr_writer :body
attribute :project do
Project.fabricate! do |resource|
resource.name = 'project-for-issue-notes'
resource.description = 'project for adding notes to issues'
end
end
attribute :issue do
Issue.fabricate! do |resource|
resource.project = project
resource.title = 'Issue for adding notes.'
resource.description = 'Issue for adding notes.'
end
end
attribute :id
attribute :body
def initialize
@body = "Issue note body #{SecureRandom.hex(8)}"
end
def fabricate!
issue.visit!
Page::Project::Issue::Show.perform do |show|
show.comment(@body)
end
end
def resource_web_url(resource)
super
rescue ResourceURLMissingError
# this particular resource does not expose a web_url property
end
def api_get_path
"/projects/#{project.id}/issues/#{issue.iid}/notes/#{id}"
end
def api_post_path
"/projects/#{project.id}/issues/#{issue.iid}/notes"
end
def api_post_body
{
body: body
}
end
end
end
end
|