title: File upload, factory_girl & database_cleaner
body: <p>In my model, I have to choose an asset, saved in a <code>editorial_asset</code> table.</p>
  
  <pre><code>include ActionDispatch::TestProcess
  
  FactoryGirl.define do
    factory :editorial_asset do
      editorial_asset { fixture_file_upload("#{Rails.root}/spec/fixtures/files/fakeUp.png", "image/png") }
    end
  end
  </code></pre>
  
  <p>so I have attached in my model factory an association on <code>:editorial_asset</code></p>
  
  <p>Upload work great, but take too much time (1s per example)</p>
  
  <p>I'm wonder if it's possible to create uploads one time before each examples, and say in the factory: "find instead of create"</p>
  
  <p>But the problem with database_cleaner, I cannot except tables with <code>:transaction</code>, truncation take 25sec instead of 40ms !</p>
  
  <h1>EDIT</h1>
  
  <p>The factory that need an asset</p>
  
  <pre><code>FactoryGirl.define do
    factory :actu do
      sequence(:title) {|n| "Actu #{n}"}
      sequence(:subtitle) {|n| "Sous-sitre #{n}"}
  
      body Lipsum.paragraphs[3]
  
      # Associations
      user
      # editorial_asset
    end
  end
  </code></pre>
  
  <p>The model spec</p>
  
  <pre><code>require 'spec_helper'
  
  describe Actu do
    before(:all) do
      @asset = create(:editorial_asset)
    end
  
    after(:all) do
      EditorialAsset.destroy_all
    end
  
    it "has a valid factory" do
      create(:actu).should be_valid
    end
  
  end
  </code></pre>
  
  <p>So a working way is</p>
  
  <pre><code>  it "has a valid factory" do
      create(:actu, editorial_asset: @asset).should be_valid
    end
  </code></pre>
  
  <p>but there's no way to inject automatically association ? </p>