Class | ActionController::TestUploadedFile |
In: |
lib/action_controller/test_process.rb
|
Parent: | 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')
path | -> | local_path |
content_type | [R] | The content type of the "uploaded" file |
original_filename | [R] | The filename, not including the path, of the "uploaded" file |