Quick Tip: Testing Multipart Uploads with RSpec
I couldn’t find this practically anywhere, so I thought I’d write a quick post on how to test multi-part uploads with RSpec. The problem is that if you try to write something like:
post :photo, :file => File.open(path)
You’ll actually be sending the string “
post :photo, :file => Rack::Test::UploadedFile.new(path, mime_type) # text/jpg