I want to test uploading a file in a Rails Rspec request test. I\'m using Paperclip for asset storage.
I\'ve tried:
path = \'path/to/fixture_file\'
para
Under describe
block, include these modules
include Rack::Test::Methods
include ActionDispatch::TestProcess
Now try running the specs
path = 'path/to/fixture_file'
params = { "file" => Rack::Test::UploadedFile.new(path, 'application/pdf', true) }
post v1_product_documents_path, params: params
Also, I guess you forgot to add ,
between v1_product_documents_path
and params: params
, please add that and let me know.
Hope that helps!