blob: c262499664e2a67fecaec654bcd5f2cb83bcc3d2 (
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
|
# frozen_string_literal: true
module QA
module Resource
class ProjectSnippet < Snippet
attribute :project do
Project.fabricate_via_api! do |resource|
resource.name = 'project-with-snippets'
end
end
def fabricate!
project.visit!
Page::Project::Menu.perform { |sidebar| sidebar.click_snippets }
Page::Project::Snippet::New.perform do |new_snippet|
new_snippet.click_create_first_snippet
new_snippet.fill_title(@title)
new_snippet.fill_description(@description)
new_snippet.set_visibility(@visibility)
new_snippet.fill_file_name(@file_name)
new_snippet.fill_file_content(@file_content)
@files.each.with_index(2) do |file, i|
new_snippet.click_add_file
new_snippet.fill_file_name(file[:name], i)
new_snippet.fill_file_content(file[:content], i)
end
new_snippet.click_create_snippet_button
end
end
def api_get_path
"/projects/#{project.id}/snippets/#{snippet_id}"
end
def api_post_path
"/projects/#{project.id}/snippets"
end
end
end
end
|