about summary refs log tree commit diff
path: root/spec/fabricators/media_attachment_fabricator.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-01-23 21:40:03 +0100
committermultiple creatures <dev@multiple-creature.party>2020-02-21 03:32:42 -0600
commite6bb4bd747a0120dd0207aecbb7c5c67b7caa165 (patch)
tree8685b5ce824c9d348620cdf6c6acc33875f9b3c8 /spec/fabricators/media_attachment_fabricator.rb
parentc8159e7ccbb0d34e4698d0d7a6312ab439e0ca5f (diff)
port tootsuite#12562 to monsterfork: Fix media attachments without file being uploadable
Fix #12554
Diffstat (limited to 'spec/fabricators/media_attachment_fabricator.rb')
-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