Sha256: e043530b3bbc9933065b436a415c458e446ed2329173cfa1af8c8c5c2f3cdb67

Contents?: true

Size: 1.16 KB

Versions: 35

Compression:

Stored size: 1.16 KB

Contents

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

      attachment_on_s3 File.open(Engine.root.join('spec', 'fixtures', 'et.ogg'))

      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 :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

      trait :waiting_for_confirmation do
        state 'waiting_for_confirmation'
      end

      trait :encoding_failed do
        state 'encoding_failed'
      end

      trait :encoded do
        state 'encoded'
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
pageflow-12.6.0 spec/factories/audio_files.rb
pageflow-12.5.0 spec/factories/audio_files.rb
pageflow-12.4.1 spec/factories/audio_files.rb
pageflow-12.4.0 spec/factories/audio_files.rb
pageflow-12.3.0 spec/factories/audio_files.rb
pageflow-12.2.0 spec/factories/audio_files.rb
pageflow-12.1.0 spec/factories/audio_files.rb
pageflow-12.0.4 spec/factories/audio_files.rb
pageflow-12.0.3 spec/factories/audio_files.rb
pageflow-12.0.2 spec/factories/audio_files.rb
pageflow-12.0.1 spec/factories/audio_files.rb
pageflow-12.0.0 spec/factories/audio_files.rb
pageflow-12.0.0.rc7 spec/factories/audio_files.rb
pageflow-12.0.0.rc6 spec/factories/audio_files.rb
pageflow-0.11.4 spec/factories/audio_files.rb
pageflow-12.0.0.rc5 spec/factories/audio_files.rb
pageflow-12.0.0.rc4 spec/factories/audio_files.rb
pageflow-12.0.0.rc3 spec/factories/audio_files.rb
pageflow-12.0.0.rc2 spec/factories/audio_files.rb
pageflow-12.0.0.rc1 spec/factories/audio_files.rb