You need to include ActionDispatch::TestProcess in your factory (Rails 3), and use the fixture_file_upload helper:
include ActionDispatch::TestProcess
FactoryGirl.define do
factory :image do
title "Example image"
file { fixture_file_upload("files/example.jpg", "image/jpeg") }
end
end
Also be sure to create an example file at test/fixtures/files/example.jpg, otherwise you will get an error that the file does not exist.