Skip to content

Commit

Permalink
Make sure multiple empty files are sent as nil, and not the empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Nicklas and Kim Burgestrand committed Jul 2, 2013
1 parent 90243d9 commit f2094fa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/capybara/spec/session/attach_file_spec.rb
Expand Up @@ -71,6 +71,11 @@
@session.body.should include(File.read(@test_file_path))
@session.body.should include(File.read(@another_test_file_path))
end

it "should not send anything when attaching no files to a multiple upload field" do
@session.click_button('Upload Empty Multiple')
@session.body.should include("Successfully ignored empty file field")
end
end

context "with a locator that doesn't exist" do
Expand Down
14 changes: 14 additions & 0 deletions lib/capybara/spec/views/form.erb
Expand Up @@ -319,6 +319,20 @@
<p>
</form>

<form action="/upload_empty" method="post" enctype="multipart/form-data">
<p>
<label>
<input type="file" name="form[file]" multiple="multiple"/>
Multiple empty files
</label>
</p>

<p>
<input type="hidden" name="form[dummy]" value="ensure params[:form] exists"/>
<input type="submit" value="Upload Empty Multiple"/>
<p>
</form>

<form action="/upload" method="post" enctype="multipart/form-data">
<p>
<label for="form_file_name">File Name</label>
Expand Down

0 comments on commit f2094fa

Please sign in to comment.