Skip to content

Commit

Permalink
test added for nested params files upload
Browse files Browse the repository at this point in the history
  • Loading branch information
zevarito committed Apr 9, 2010
1 parent c49e23d commit e364874
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/private/rails/attaches_file_spec.rb
Expand Up @@ -93,4 +93,22 @@
attach_file "Photo", @filename
click_button
end

it "should support nested attributes with multiple files" do
with_html <<-HTML
<html>
<form method="post" action="/albums">
<label for="photo_file1">Photo 1</label>
<input type="file" id="photo_file1" name="album[photos_attributes][][image]" />
<label for="photo_file2">Photo 2</label>
<input type="file" id="photo_file2" name="album[photos_attributes][][image]" />
<input type="submit" />
</form>
</html>
HTML
webrat_session.should_receive(:post).with("/albums", { "album" => { "photos_attributes" => [{"image" => @uploaded_file}, {"image" => @uploaded_file}] } })
attach_file "Photo 1", @filename
attach_file "Photo 2", @filename
click_button
end
end

0 comments on commit e364874

Please sign in to comment.