I was writing specs for a controller that processes uploaded images, and came up with this way of mocking a file upload control. So, I thought I'd share it. Say you have a WibbleController which can replace the image belonging to a particular wibble. In your wibble/edit view you probably have something like this; <% form_for(@wibble, :html => { :multipart => true }) do |f| %> ... Replace with new