about summary refs log tree commit diff
path: root/spec/fabricators
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-01-23 21:40:03 +0100
committerGitHub <noreply@github.com>2020-01-23 21:40:03 +0100
commit81cc86bb1ffb662843938379eeb522e3a6f11b79 (patch)
tree8fb79407b7318731ad9e240383593ed3a45d9149 /spec/fabricators
parent43daeccccb31a0145c48f41c4ba449f0a3967ef2 (diff)
Fix media attachments without file being uploadable (#12562)
Fix #12554
Diffstat (limited to 'spec/fabricators')
-rw-r--r--spec/fabricators/media_attachment_fabricator.rb18
1 files changed, 7 insertions, 11 deletions
diff --git a/spec/fabricators/media_attachment_fabricator.rb b/spec/fabricators/media_attachment_fabricator.rb
index bb938e36d..651927c2d 100644
--- a/spec/fabricators/media_attachment_fabricator.rb
+++ b/spec/fabricators/media_attachment_fabricator.rb
@@ -1,16 +1,12 @@
 Fabricator(:media_attachment) do
   account
+
   file do |attrs|
-    [
-      case attrs[:type]
-      when :gifv
-        attachment_fixture ['attachment.gif', 'attachment.webm'].sample
-      when :image
-        attachment_fixture 'attachment.jpg'
-      when nil
-        attachment_fixture ['attachment.gif', 'attachment.jpg', 'attachment.webm'].sample
-      end,
-      nil
-    ].sample
+    case attrs[:type]
+    when :gifv, :video
+      attachment_fixture('attachment.webm')
+    else
+      attachment_fixture('attachment.jpg')
+    end
   end
 end