From 81cc86bb1ffb662843938379eeb522e3a6f11b79 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 23 Jan 2020 21:40:03 +0100 Subject: Fix media attachments without file being uploadable (#12562) Fix #12554 --- spec/fabricators/media_attachment_fabricator.rb | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'spec/fabricators') 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 -- cgit