diff options
| author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 21:09:34 +0100 |
|---|---|---|
| committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-02-28 21:09:34 +0100 |
| commit | 8af23def1d6450420d06b8de54d23311a978de20 (patch) | |
| tree | 5da743be888022a197e2555bbcd12076a9ca3633 /spec/factories | |
| parent | 54a575f1bbba44573ab92dc58a4242f1ee734c5d (diff) | |
| download | gitlab-ce-8af23def1d6450420d06b8de54d23311a978de20.tar.gz | |
Revert "Merge branch '3867-port-to-ce' into 'master'"
This reverts commit 54a575f1bbba44573ab92dc58a4242f1ee734c5d, reversing
changes made to c63af942e5baf7849a94fa99da8494bcba28e3f8.
Diffstat (limited to 'spec/factories')
| -rw-r--r-- | spec/factories/groups.rb | 2 | ||||
| -rw-r--r-- | spec/factories/notes.rb | 4 | ||||
| -rw-r--r-- | spec/factories/projects.rb | 2 | ||||
| -rw-r--r-- | spec/factories/uploads.rb | 26 | ||||
| -rw-r--r-- | spec/factories/users.rb | 2 |
5 files changed, 9 insertions, 27 deletions
diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb index 8c531cf5909..1512f5a0e58 100644 --- a/spec/factories/groups.rb +++ b/spec/factories/groups.rb @@ -18,7 +18,7 @@ FactoryBot.define do end trait :with_avatar do - avatar { fixture_file_upload('spec/fixtures/dk.png') } + avatar { File.open(Rails.root.join('spec/fixtures/dk.png')) } end trait :access_requestable do diff --git a/spec/factories/notes.rb b/spec/factories/notes.rb index 3f4e408b3a6..2defb4935ad 100644 --- a/spec/factories/notes.rb +++ b/spec/factories/notes.rb @@ -122,11 +122,11 @@ FactoryBot.define do end trait :with_attachment do - attachment { fixture_file_upload(Rails.root.join( "spec/fixtures/dk.png"), "image/png") } + attachment { fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png") } end trait :with_svg_attachment do - attachment { fixture_file_upload(Rails.root.join("spec/fixtures/unsanitized.svg"), "image/svg+xml") } + attachment { fixture_file_upload(Rails.root + "spec/fixtures/unsanitized.svg", "image/svg+xml") } end transient do diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 16d328a5bc2..d0f3911f730 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -90,7 +90,7 @@ FactoryBot.define do end trait :with_avatar do - avatar { fixture_file_upload('spec/fixtures/dk.png') } + avatar { File.open(Rails.root.join('spec/fixtures/dk.png')) } end trait :broken_storage do diff --git a/spec/factories/uploads.rb b/spec/factories/uploads.rb index c8cfe251d27..c39500faea1 100644 --- a/spec/factories/uploads.rb +++ b/spec/factories/uploads.rb @@ -1,42 +1,24 @@ FactoryBot.define do factory :upload do model { build(:project) } + path { "uploads/-/system/project/avatar/avatar.jpg" } size 100.kilobytes uploader "AvatarUploader" - # we should build a mount agnostic upload by default - transient do - mounted_as :avatar - secret SecureRandom.hex - 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') } - - trait :personal_snippet_upload do + trait :personal_snippet do model { build(:personal_snippet) } - path { File.join(secret, 'myfile.jpg') } uploader "PersonalFileUploader" end trait :issuable_upload do - path { File.join(secret, 'myfile.jpg') } + path { "#{SecureRandom.hex}/myfile.jpg" } uploader "FileUploader" end trait :namespace_upload do + path { "#{SecureRandom.hex}/myfile.jpg" } model { build(:group) } - path { File.join(secret, 'myfile.jpg') } uploader "NamespaceFileUploader" end - - trait :attachment_upload do - transient do - mounted_as :attachment - end - - model { build(:note) } - uploader "AttachmentUploader" - end end end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 769fd656e7a..e62e0b263ca 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -38,7 +38,7 @@ FactoryBot.define do end trait :with_avatar do - avatar { fixture_file_upload('spec/fixtures/dk.png') } + avatar { File.open(Rails.root.join('spec/fixtures/dk.png')) } end trait :two_factor_via_otp do |
