forked from discourse/discourse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexternal_upload_stub_fabricator.rb
46 lines (41 loc) · 1.1 KB
/
external_upload_stub_fabricator.rb
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
# frozen_string_literal: true
Fabricator(:external_upload_stub) do
transient :folder_prefix
created_by { Fabricate(:user) }
original_filename "test.txt"
key do |attrs|
FileStore::BaseStore.temporary_upload_path(
"test.txt",
folder_prefix: attrs[:folder_prefix] || "",
)
end
upload_type "card_background"
filesize 1024
status 1
end
Fabricator(:image_external_upload_stub, from: :external_upload_stub) do
original_filename "logo.png"
filesize 1024
key do |attrs|
FileStore::BaseStore.temporary_upload_path(
"logo.png",
folder_prefix: attrs[:folder_prefix] || "",
)
end
end
Fabricator(:attachment_external_upload_stub, from: :external_upload_stub) do
original_filename "file.pdf"
filesize 1024
key do |attrs|
FileStore::BaseStore.temporary_upload_path(
"file.pdf",
folder_prefix: attrs[:folder_prefix] || "",
)
end
end
Fabricator(:multipart_external_upload_stub, from: :external_upload_stub) do
multipart true
external_upload_identifier do
"#{SecureRandom.hex(6)}._#{SecureRandom.hex(6)}_#{SecureRandom.hex(6)}.d.ghQ"
end
end