Class ActionController::TestUploadedFile
In: vendor/rails/actionpack/lib/action_controller/test_process.rb
Parent: Object

Methods

new  

External Aliases

path -> local_path

Attributes

content_type  [R]  The content type of the "uploaded" file
original_filename  [R]  The filename, not including the path, of the "uploaded" file

Public Class methods

[Source]

     # File vendor/rails/actionpack/lib/action_controller/test_process.rb, line 331
331:     def initialize(path, content_type = 'text/plain')
332:       raise "#{path} file does not exist" unless File.exist?(path)
333:       @content_type = content_type
334:       @original_filename = path.sub(/^.*#{File::SEPARATOR}([^#{File::SEPARATOR}]+)$/) { $1 }
335:       @tempfile = Tempfile.new(@original_filename)
336:       FileUtils.copy_file(path, @tempfile.path)
337:     end

[Validate]