Parent

Methods

Class/Module Index [+]

Quicksearch

ActionController::TestUploadedFile

Attributes

content_type[RW]

The content type of the “uploaded” file

original_filename[R]

The filename, not including the path, of the “uploaded” file

Public Class Methods

new(path, content_type = Mime::TEXT, binary = false) click to toggle source
# File lib/action_controller/test_process.rb, line 373
def initialize(path, content_type = Mime::TEXT, binary = false)
  raise "#{path} file does not exist" unless File.exist?(path)
  @content_type = content_type
  @original_filename = path.sub(/^.*#{File::SEPARATOR}([^#{File::SEPARATOR}]+)$/) { $1 }
  @tempfile = Tempfile.new(@original_filename)
  @tempfile.set_encoding(Encoding::BINARY) if @tempfile.respond_to?(:set_encoding)
  @tempfile.binmode if binary
  FileUtils.copy_file(path, @tempfile.path)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.