Skip to content

Instantly share code, notes, and snippets.

@halfbyte
Created August 19, 2008 13:35
Show Gist options
  • Save halfbyte/6180 to your computer and use it in GitHub Desktop.
Save halfbyte/6180 to your computer and use it in GitHub Desktop.
def mock_uploader(file, type = 'image/png')
filename = "%s/%s" % [ File.dirname(__FILE__), file ]
uploader = ActionController::UploadedStringIO.new
uploader.original_path = filename
uploader.content_type = type
def uploader.read
File.read(original_path)
end
def uploader.size
File.stat(original_path).size
end
uploader
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment