Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-02-05 18:28:09 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-02-05 18:28:09 +0300
commit0e15a5b805e832c22c67cead8c4829e6c77cd498 (patch)
treeb089759f9810c6439198e134615196b4d8078559 /spec/factories
parent2fe09e6a12e4f533d77517ddd7fe40fc53522f92 (diff)
parentce84d1835332932e25ebdc2cfbe44ff301328a1f (diff)
Merge branch '42547-upload-store-mount-point' into 'master'
Store uploader context in uploads Closes #42547 See merge request gitlab-org/gitlab-ce!16779
Diffstat (limited to 'spec/factories')
-rw-r--r--spec/factories/uploads.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/spec/factories/uploads.rb b/spec/factories/uploads.rb
index c8cfe251d27..ff3a2a76acc 100644
--- a/spec/factories/uploads.rb
+++ b/spec/factories/uploads.rb
@@ -3,36 +3,40 @@ FactoryBot.define do
model { build(:project) }
size 100.kilobytes
uploader "AvatarUploader"
+ mount_point :avatar
+ secret nil
# we should build a mount agnostic upload by default
transient do
- mounted_as :avatar
- secret SecureRandom.hex
+ filename 'myfile.jpg'
end
# this needs to comply with RecordsUpload::Concern#upload_path
- path { File.join("uploads/-/system", model.class.to_s.underscore, mounted_as.to_s, 'avatar.jpg') }
+ path { File.join("uploads/-/system", model.class.to_s.underscore, mount_point.to_s, 'avatar.jpg') }
trait :personal_snippet_upload do
- model { build(:personal_snippet) }
- path { File.join(secret, 'myfile.jpg') }
uploader "PersonalFileUploader"
+ path { File.join(secret, filename) }
+ model { build(:personal_snippet) }
+ secret SecureRandom.hex
end
trait :issuable_upload do
- path { File.join(secret, 'myfile.jpg') }
uploader "FileUploader"
+ path { File.join(secret, filename) }
+ secret SecureRandom.hex
end
trait :namespace_upload do
model { build(:group) }
- path { File.join(secret, 'myfile.jpg') }
+ path { File.join(secret, filename) }
uploader "NamespaceFileUploader"
+ secret SecureRandom.hex
end
trait :attachment_upload do
transient do
- mounted_as :attachment
+ mount_point :attachment
end
model { build(:note) }