Class: Capybara::Driver::RackTest::Form::NilUploadedFile

Inherits:
Rack::Test::UploadedFile
  • Object
show all
Defined in:
lib/capybara/driver/rack_test_driver.rb

Overview

This only needs to inherit from Rack::Test::UploadedFile because Rack::Test checks for the class specifically when determing whether to consturct the request as multipart. That check should be based solely on the form element's 'enctype' attribute value, which should probably be provided to Rack::Test in its non-GET request methods.

Instance Method Summary collapse

Constructor Details

#initialize ⇒ NilUploadedFile

Returns a new instance of NilUploadedFile.



113
114
115
116
# File 'lib/capybara/driver/rack_test_driver.rb', line 113

def initialize
  @empty_file = Tempfile.new("nil_uploaded_file")
  @empty_file.close
end

Instance Method Details

#content_type ⇒ Object



119
# File 'lib/capybara/driver/rack_test_driver.rb', line 119

def content_type; "application/octet-stream"; end

#original_filename ⇒ Object



118
# File 'lib/capybara/driver/rack_test_driver.rb', line 118

def original_filename; ""; end

#path ⇒ Object



120
# File 'lib/capybara/driver/rack_test_driver.rb', line 120

def path; @empty_file.path; end