blob: f14fcdaac9fa860fa467ecc8cb000efdb10d6c29 (
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
|
# frozen_string_literal: true
module QA
module Resource
class CiVariable < Base
attr_accessor :key, :value, :masked
attribute :project do
Project.fabricate! do |resource|
resource.name = 'project-with-ci-variables'
resource.description = 'project for adding CI variable test'
end
end
def fabricate!
project.visit!
Page::Project::Menu.perform(&:go_to_ci_cd_settings)
Page::Project::Settings::CICD.perform do |setting|
setting.expand_ci_variables do |page|
page.click_add_variable
page.fill_variable(key, value, masked)
end
end
end
def fabricate_via_api!
resource_web_url(api_get)
rescue ResourceNotFoundError
super
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}/variables/#{key}"
end
def api_post_path
"/projects/#{project.id}/variables"
end
def api_post_body
{
key: key,
value: value,
masked: masked
}
end
end
end
end
|