diff options
author | Micaël Bergeron <mbergeron@gitlab.com> | 2018-01-29 16:06:17 -0500 |
---|---|---|
committer | Micaël Bergeron <mbergeron@gitlab.com> | 2018-02-02 09:28:15 -0500 |
commit | 74ddc80590053b04b90c35ae3e1f46bfbd9d0d15 (patch) | |
tree | 145eaf19ac0a06a7bb8e5a0d85b97606ccaf77eb /spec/factories | |
parent | 54a575f1bbba44573ab92dc58a4242f1ee734c5d (diff) | |
download | gitlab-ce-74ddc80590053b04b90c35ae3e1f46bfbd9d0d15.tar.gz |
add the uploader context to the upload model
Diffstat (limited to 'spec/factories')
-rw-r--r-- | spec/factories/uploads.rb | 20 |
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) } |