I'm creating a program which will be examining images which are uploaded by the users logged in. I have the RMagick code written up to do the examination (basically finding out if a pixel black is in an image), but I don't know how to write the unit tests for this model.
Currently I'm using paperclip to attach the uploaded file to the model, which I understand uses a number of fields in the database for tracking the files. How should I set up my fixtures so that I can do unit testing on the same data every time?
My model is currently:
class Map < ActiveRecord::Base
has_attached_file :image, :styles => { :small => "150x150>" }
validates_attachment_presence :image
validates_uniqueness_of :name, :message => "must be unique"
def pixel_is_black(x, y)
<code to return true if position (x,y) in image is black>
end
end