blob: 29ddbb22a018ec0f1d01c6b4a9fdc4756cf8f91f (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# frozen_string_literal: true
module QA
RSpec.describe 'Create' do
describe 'Multiple file snippet' do
let(:first_file_content) { 'First file content' }
let(:second_file_content) { 'Second file content' }
let(:third_file_content) { 'Third file content' }
let(:personal_snippet) do
Resource::Snippet.fabricate_via_api! do |snippet|
snippet.title = 'Personal snippet to copy file contents from'
snippet.file_name = 'First file name'
snippet.file_content = first_file_content
snippet.add_files do |files|
files.append(name: 'Second file name', content: second_file_content)
files.append(name: 'Third file name', content: third_file_content)
end
end
end
let(:project_snippet) do
Resource::ProjectSnippet.fabricate_via_api! do |snippet|
snippet.title = 'Project snippet to copy file contents from'
snippet.file_name = 'First file name'
snippet.file_content = first_file_content
snippet.add_files do |files|
files.append(name: 'Second file name', content: second_file_content)
files.append(name: 'Third file name', content: third_file_content)
end
end
end
let(:files) do
[
{
number: 1,
content: first_file_content
},
{
number: 2,
content: second_file_content
},
{
number: 3,
content: third_file_content
}
]
end
before do
Flow::Login.sign_in
end
after do
personal_snippet&.remove_via_api!
project_snippet&.remove_via_api!
end
shared_examples 'copying snippet file contents' do |snippet_type|
it "copies file contents of a multi-file #{snippet_type} to a comment and verifies them" do
send(snippet_type).visit!
files.each do |files|
Page::Dashboard::Snippet::Show.perform do |snippet|
snippet.copy_file_contents_to_comment(files[:number])
expect(snippet).to have_comment_content(files[:content])
snippet.delete_comment(files[:content])
end
end
end
end
it_behaves_like 'copying snippet file contents', :personal_snippet
it_behaves_like 'copying snippet file contents', :project_snippet
end
end
end
|