Class: Capybara::RackTest::Form::NilUploadedFile
- Inherits:
-
Rack::Test::UploadedFile
- Object
- Rack::Test::UploadedFile
- Capybara::RackTest::Form::NilUploadedFile
- 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
- #content_type ⇒ Object
-
#initialize ⇒ NilUploadedFile
constructor
A new instance of NilUploadedFile.
- #original_filename ⇒ Object
- #path ⇒ Object
- #read ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize ⇒ NilUploadedFile
Returns a new instance of NilUploadedFile.
9 10 11 12 |
# File 'lib/capybara/rack_test/form.rb', line 9 def initialize @empty_file = Tempfile.new('nil_uploaded_file') @empty_file.close end |
Instance Method Details
#content_type ⇒ Object
15 |
# File 'lib/capybara/rack_test/form.rb', line 15 def content_type; 'application/octet-stream'; end |
#original_filename ⇒ Object
14 |
# File 'lib/capybara/rack_test/form.rb', line 14 def original_filename; ''; end |
#path ⇒ Object
16 |
# File 'lib/capybara/rack_test/form.rb', line 16 def path; @empty_file.path; end |
#read ⇒ Object
18 |
# File 'lib/capybara/rack_test/form.rb', line 18 def read; ''; end |
#size ⇒ Object
17 |
# File 'lib/capybara/rack_test/form.rb', line 17 def size; 0; end |