Shortcut for ActionController::TestUploadedFile.new(Test::Unit::TestCase.fixture_path + path, type). Example:
post :change_avatar, :avatar => fixture_file_upload('/files/spongebob.png', 'image/png')
To upload binary files on Windows, pass :binary as the last parameter. This will not affect other platforms.
post :change_avatar, :avatar => fixture_file_upload('/files/spongebob.png', 'image/png', :binary)
Source Code
# File action_controller/test_process.rb, line 474 def fixture_file_upload(path, mime_type = nil, binary = false) ActionController::TestUploadedFile.new( Test::Unit::TestCase.respond_to?(:fixture_path) ? Test::Unit::TestCase.fixture_path + path : path, mime_type, binary ) end
<code/>and<pre/>for code samples.