spec/factories/audio_files.rb in pageflow-13.6.0 vs spec/factories/audio_files.rb in pageflow-14.0.0.beta1

- old
+ new

@@ -2,11 +2,12 @@ FactoryBot.define do factory :audio_file, :class => AudioFile do entry uploader { create(:user) } - attachment_on_s3 { File.open(Engine.root.join('spec', 'fixtures', 'et.ogg')) } + attachment { File.open(Engine.root.join('spec', 'fixtures', 'et.ogg')) } + state { 'encoded' } transient do used_in { nil } end @@ -16,31 +17,37 @@ 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' } + trait :uploading do + attachment { nil } + file_name { 'et.ogg' } + state { 'uploading' } + + after :create do |audio_file| + simulate_direct_upload(audio_file) + end 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' } + trait :uploaded do + uploading + state { 'uploaded' } end + trait :uploading_failed do + state { 'uploading_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