FactoryBot.define do
  factory :target_file do
    original_file { Tempfile.new("target_file_factory") }
    trait :failed do
      after(:build) { |record| record.log_entries.build(body: 'ERROR - some reason to fail') }
      state 'failed'
    end
  end

  factory 'target_file/my_target', aliases: [:target_file_my_target], class: 'TargetFile::MyTarget', parent: :target_file
end
