title: How to upload a file in a Rails Rspec request spec
body: <p>I want to test uploading a file in a Rails Rspec request test.  I'm using Paperclip for asset storage.</p>
  
  <p>I've tried:</p>
  
  <pre><code>path = 'path/to/fixture_file'
  params = { file: Rack::Test::UploadedFile.new(path, 'application/pdf', true) }
  post v1_product_documents_path, params: params
  </code></pre>
  
  <p>In the controller, I get a string </p>
  
  <blockquote>
    <p>"#Rack::Test::UploadedFile:0x0055b544479128>"<br></p>
  </blockquote>
  
  <p>instead of the actual file.</p>
  
  <p>The same code works in controller tests</p>