Sha256: 8c9d50750ac0ab1edbbb21fa7f7f4ff21f2ecb38dd8340a9068edda48506331c
Contents?: true
Size: 1.2 KB
Versions: 10
Compression:
Stored size: 1.2 KB
Contents
module Pageflow FactoryBot.define do factory :text_track_file, class: TextTrackFile do entry uploader { create(:user) } parent_file { nil } attachment_on_s3 { File.open(Engine.root.join('spec', 'fixtures', 'sample.vtt')) } transient do used_in { nil } end before(:create) do |file, evaluator| file.entry = evaluator.used_in.entry if evaluator.used_in file.parent_file ||= create(:video_file, used_in: file.entry.draft) end after(:create) do |file, evaluator| create(:file_usage, file: file, revision: evaluator.used_in) if evaluator.used_in end trait :from_srt_file do attachment_on_s3 { File.open(Engine.root.join('spec', 'fixtures', 'sample.srt')) } end trait :on_filesystem do attachment_on_filesystem { File.open(Engine.root.join('spec', 'fixtures', 'et.ogg')) } attachment_on_s3 { nil } state { 'not_uploaded_to_s3' } end trait :uploading_to_s3_failed do attachment_on_filesystem { File.open(Engine.root.join('spec', 'fixtures', 'et.ogg')) } attachment_on_s3 { nil } state { 'uploading_to_s3_failed' } end end end end
Version data entries
10 entries across 10 versions & 1 rubygems