Sha256: ae8f1b1c10b219987f6b7bfbd87942371ffa2441232c2f962eec1cbc31756410
Contents?: true
Size: 1.13 KB
Versions: 10
Compression:
Stored size: 1.13 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 } end before(:create) do |file, evaluator| file.entry = evaluator.used_in.entry if evaluator.used_in end after(:create) do |file, evaluator| create(:file_usage, :file => file, :revision => evaluator.used_in) if evaluator.used_in end trait :processed do processed_attachment { File.open(Engine.root.join('spec', 'fixtures', 'image.jpg')) } end trait :unprocessed do unprocessed_attachment { File.open(Engine.root.join('spec', 'fixtures', 'image.jpg')) } processed_attachment { nil } state { 'not_processed' } end trait :failed do unprocessed_attachment { File.open(Engine.root.join('spec', 'fixtures', 'image.jpg')) } processed_attachment { nil } state { 'processing_failed' } end trait :encoded do end end end end
Version data entries
10 entries across 10 versions & 1 rubygems