aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-09-20 00:10:16 -0700
committerSantiago Pastorino <santiago@wyeworks.com>2010-09-20 01:11:55 -0700
commit0523b55ab9f823b0cb3643714e890b2c2077820e (patch)
tree190d49dec912f0b34c60e0483c17654ba282b579 /actionpack/test/template
parent800bab79b38949d454e0ef9b33f7cc1be912e0fa (diff)
downloadrails-0523b55ab9f823b0cb3643714e890b2c2077820e.tar.gz
rails-0523b55ab9f823b0cb3643714e890b2c2077820e.tar.bz2
rails-0523b55ab9f823b0cb3643714e890b2c2077820e.zip
file_field propagates up multipart property even inside of fields_for
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/form_helper_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index 2f20bfa719..d40dd409b8 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -689,6 +689,27 @@ class FormHelperTest < ActionView::TestCase
assert_dom_equal expected, output_buffer
end
+ def test_fields_for_with_file_field_generate_multipart
+ Comment.send :attr_accessor, :file
+
+ assert_deprecated do
+ form_for(:post, @post) do |f|
+ concat f.fields_for(:comment, @post) { |c|
+ concat c.file_field(:file)
+ }
+ end
+ end
+
+ expected =
+ "<form accept-charset='UTF-8' action='/' method='post' enctype='multipart/form-data'>" +
+ snowman +
+ "<input name='post[comment][file]' type='file' id='post_comment_file' />" +
+ "</form>"
+
+ assert_dom_equal expected, output_buffer
+ end
+
+
def test_form_for_with_format
form_for(@post, :format => :json, :html => { :id => "edit_post_123", :class => "edit_post" }) do |f|
concat f.label(:title)