file_uploaders.rb 428 Bytes
Newer Older
1
FactoryBot.define do
2
  factory :file_uploader do
3 4
    skip_create

5
    project
6 7 8
    secret nil

    transient do
9 10
      fixture { 'rails_sample.jpg' }
      path { File.join(Rails.root, 'spec/fixtures', fixture) }
11 12 13 14 15 16 17 18 19 20 21 22
      file { Rack::Test::UploadedFile.new(path) }
    end

    after(:build) do |uploader, evaluator|
      uploader.store!(evaluator.file)
    end

    initialize_with do
      new(project, secret)
    end
  end
end