class
ActionController::TestUploadedFile
v1.1.6 -
Show latest stable
- Superclass: Object
Essentially generates a modified Tempfile object similar to the object you’d get from the standard library CGI module in a multipart request. This means you can use an ActionController::TestUploadedFile object in the params of a test request in order to simulate a file upload.
Usage example, within a functional test:
post :change_avatar, :avatar => ActionController::TestUploadedFile.new(Test::Unit::TestCase.fixture_path + '/files/spongebob.png', 'image/png')
Attributes
| [R] | content_type |
| [R] | original_filename |
Files
- actionpack/lib/action_controller/test_process.rb
1Note
Easier way
See http://apidock.com/rails/ActionController/TestProcess/fixture_file_upload for easier way to test file uploads.