test added for nested params files upload
This commit is contained in:
parent
c49e23d81d
commit
e36487458f
@ -93,4 +93,22 @@ describe "attach_file" do
|
|||||||
attach_file "Photo", @filename
|
attach_file "Photo", @filename
|
||||||
click_button
|
click_button
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user