Object
Wraps a Tempfile with a content type. Including one or more UploadedFile’s in the params causes Rack::Test to build and issue a multipart request.
Example:
post "/photos", "file" => Rack::Test::UploadedFile.new("me.jpg", "image/jpeg")
# File lib/rack/test/uploaded_file.rb, line 20 20: def initialize(path, content_type = "text/plain", binary = false) 21: raise "#{path} file does not exist" unless ::File.exist?(path) 22: 23: @content_type = content_type 24: @original_filename = ::File.basename(path) 25: 26: @tempfile = Tempfile.new(@original_filename) 27: @tempfile.set_encoding(Encoding::BINARY) if @tempfile.respond_to?(:set_encoding) 28: @tempfile.binmode if binary 29: 30: FileUtils.copy_file(path, @tempfile.path) 31: end
# File lib/rack/test/uploaded_file.rb, line 33 33: def path 34: @tempfile.path 35: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.