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

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

Overview

This only needs to inherit from Rack::Test::UploadedFile because Rack::Test checks for the class specifically when determining whether to construct 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

- (NilUploadedFile) initialize

Returns a new instance of NilUploadedFile



7
8
9
10
# File 'lib/capybara/rack_test/form.rb', line 7

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

Instance Method Details

- (Object) content_type



13
# File 'lib/capybara/rack_test/form.rb', line 13

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

- (Object) original_filename



12
# File 'lib/capybara/rack_test/form.rb', line 12

def original_filename; ""; end

- (Object) path



14
# File 'lib/capybara/rack_test/form.rb', line 14

def path; @empty_file.path; end