diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-09-16 23:31:57 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-09-18 12:31:00 -0700 |
commit | b17b980a15ee4a5f2f629d91c6fa6ca7db74daa8 (patch) | |
tree | 7364a2b582686c915d6949042c63ac94fbd0ad8a /actionpack/test/template | |
parent | e8082246529737b6cf0d5cc3c948e54896aa1329 (diff) | |
download | rails-b17b980a15ee4a5f2f629d91c6fa6ca7db74daa8.tar.gz rails-b17b980a15ee4a5f2f629d91c6fa6ca7db74daa8.tar.bz2 rails-b17b980a15ee4a5f2f629d91c6fa6ca7db74daa8.zip |
file_field makes the enclosing form multipart
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 97a08d45ba..348aa208c7 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -665,6 +665,24 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end + def test_form_for_with_file_field_generate_multipart + Post.send :attr_accessor, :file + + assert_deprecated do + form_for(:post, @post, :html => { :id => 'create-post' }) do |f| + concat f.file_field(:file) + end + end + + expected = + "<form accept-charset='UTF-8' action='/' id='create-post' method='post' enctype='multipart/form-data'>" + + snowman + + "<input name='post[file]' type='file' id='post_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) |