Sha256: da4c1f4dc0f90eb5e01660791d9917807ed01c2fdab3dc18edb1099353bdd46b

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

module Pageflow
  FactoryGirl.define do
    factory :video_file, :class => VideoFile do
      entry
      uploader { create(:user) }

      attachment_on_s3 File.open(Engine.root.join('spec', 'fixtures', 'video.mp4'))
      state 'encoded'

      ignore 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 :on_filesystem do
        attachment_on_filesystem File.open(Engine.root.join('spec', 'fixtures', 'video.mp4'))
        attachment_on_s3 nil
        state 'not_uploaded_to_s3'
      end

      trait :upload_to_s3_failed do
        attachment_on_filesystem File.open(Engine.root.join('spec', 'fixtures', 'video.mp4'))
        attachment_on_s3 nil
        state 'upload_to_s3_failed'
      end

      trait :waiting_for_confirmation do
        state 'waiting_for_confirmation'
      end

      trait :encoding_failed do
        state 'encoding_failed'
      end

      trait :encoded do
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pageflow-0.4.0 spec/factories/video_files.rb
pageflow-0.3.0 spec/factories/video_files.rb
pageflow-0.2.1 spec/factories/video_files.rb
pageflow-0.2.0 spec/factories/video_files.rb