I want to check file upload in a Rails Rails test. I use Paperclip to store assets.
I tried:
path = 'path/to/fixture_file' params = { file: Rack::Test::UploadedFile.new(path, 'application/pdf', true) } post v1_product_documents_path, params: params
In the controller, I get the line
"# Rack :: Test :: UploadedFile: 0x0055b544479128>"
instead of the actual file.
The same code works in controller tests
ruby-on-rails ruby-on-rails-5 rspec
hirowatari
source share