-
-
Save Epictetus/1360956 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Paperclip - Factory_Girl for Rails 3 beta 4 | |
Factory.define :contacts_short_csv, :class => 'CsvFile' do |f| | |
include ActionDispatch::TestProcess | |
f.csv { fixture_file_upload( 'files/contacts_short.csv.upload', 'text/csv') } | |
f.account_id { 1 } | |
end | |
My model is | |
class CsvFile < ActiveRecord::Base | |
include Paperclip | |
has_attached_file :csv | |
end | |
The CSV file is actually under test/fixtures/files/ and since they are not real fixture data, but actual CSV data for testing the data import process, I had to rename them as .csv.upload otherwise Rails's test will try to populate the test databases with them (and fail miserably) | |
I'm using Rails 3b4, with latest paperclip 61f74...eed69-master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment