about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/fabricators/media_attachment_fabricator.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/fabricators/media_attachment_fabricator.rb b/spec/fabricators/media_attachment_fabricator.rb
index c5dfe12e5..bb938e36d 100644
--- a/spec/fabricators/media_attachment_fabricator.rb
+++ b/spec/fabricators/media_attachment_fabricator.rb
@@ -1,4 +1,16 @@
 Fabricator(:media_attachment) do
   account
-  file { [attachment_fixture(['attachment.gif', 'attachment.jpg', 'attachment.webm'].sample), nil].sample }
+  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
+  end
 end