Skip to content

Instantly share code, notes, and snippets.

@zmack
Created February 21, 2010 15:27
Show Gist options
  • Save zmack/310373 to your computer and use it in GitHub Desktop.
Save zmack/310373 to your computer and use it in GitHub Desktop.
def fixture_file_upload_fg(name, options = {})
path = File.join(File.dirname(__FILE__), 'fixtures', 'files', name)
m = Module.new do
define_method :content_type do
options[:content_type] || 'application/x-shockwave-flash'
end
define_method :original_filename do
name
end
define_method :size do
File.size(path)
end
end
File.open(path).extend(m)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment