Skip to content

Instantly share code, notes, and snippets.

@dougal
Created December 16, 2011 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougal/1487192 to your computer and use it in GitHub Desktop.
Save dougal/1487192 to your computer and use it in GitHub Desktop.
class ClassificationSet < ActiveRecord::Base
mount_uploader :reference_file, ReferenceFileUploader
validates :reference_file, :presence => { :message => "must have a file selected" }
end
Factory.define :classification_set do |c|
c.images_zip { File.open(Rails.root.join('spec', 'file_fixtures', 'images.zip')) }
c.reference_file { File.open(Rails.root.join('spec', 'file_fixtures', 'reference_file.txt')) }
end
Factory(:classification_set)
# Failure/Error: classification_set = Factory(:classification_set)
# ActiveRecord::RecordInvalid:
# Validation failed: Reference file must have a file selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment