file_uploader.rb 436 Bytes
Newer Older
1
FactoryGirl.define do
2
  factory :file_uploader do
3
    project factory: :empty_project
4 5 6
    secret nil

    transient do
7 8
      fixture { 'rails_sample.jpg' }
      path { File.join(Rails.root, 'spec/fixtures', fixture) }
9 10 11 12 13 14 15 16 17 18 19 20
      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