Sha256: 192380dd454a43dd4ac90b10290f548ce7953c2cb1731beba0079f7b2a2fbb17
Contents?: true
Size: 1.28 KB
Versions: 29
Compression:
Stored size: 1.28 KB
Contents
module Pageflow FactoryBot.define do factory :image_file, :class => ImageFile do entry uploader { create(:user) } attachment { File.open(Engine.root.join('spec', 'fixtures', 'image.jpg')) } state { 'processed' } transient do used_in { nil } with_configuration { nil } end before(:create) do |file, evaluator| file.entry = evaluator.used_in.entry if evaluator.used_in end after(:create) do |file, evaluator| if evaluator.used_in create(:file_usage, file: file, revision: evaluator.used_in, configuration: evaluator.with_configuration) end end trait :uploading do attachment { nil } file_name { 'image.jpg' } state { 'uploading' } after :create do |image_file| simulate_direct_upload(image_file) end end trait :uploaded do uploading state { 'uploaded' } end trait :uploading_failed do state { 'uploading_failed' } end trait :processing do state { 'processing' } end trait :processed do end trait :processing_failed do state { 'processing_failed' } end end end end
Version data entries
29 entries across 29 versions & 1 rubygems