diff options
author | Akihiko Odaki (@fn_aki@pawoo.net) <akihiko.odaki.4i@stu.hosei.ac.jp> | 2017-06-21 03:40:45 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-06-20 20:40:45 +0200 |
commit | 356df7ae6b6edfc600fbc532f32fbc46314e00a0 (patch) | |
tree | 426d636da22c023ed5e018431356cf99777734b1 /spec | |
parent | 8f03fdce7fa16fcaa829a40f395cefc85eb957d5 (diff) |
Update fabricator for MediaAttachment to attach a file according to type (#3862)
This fixes a random spec failures since commit d55f207274648369cba30ff001aa3e354fa30dca.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fabricators/media_attachment_fabricator.rb | 14 |
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 |