aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-12-02 00:46:43 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-12-02 00:46:43 +0000
commitd0ce7cd4c7eb24c4ade6d8fb4ec73576b8bc1977 (patch)
tree17afa00c5a7b0a69d6b882756c1c31781df534e6 /actionpack/test
parent67442cb40d0850f42ff66a66e2c2b3f5cf5feb07 (diff)
downloadrails-d0ce7cd4c7eb24c4ade6d8fb4ec73576b8bc1977.tar.gz
rails-d0ce7cd4c7eb24c4ade6d8fb4ec73576b8bc1977.tar.bz2
rails-d0ce7cd4c7eb24c4ade6d8fb4ec73576b8bc1977.zip
Added the same record identification guessing rules to fields_for as form_for has [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8252 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/form_helper_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index fa53f6ae1a..136e6f1e83 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -433,6 +433,23 @@ class FormHelperTest < Test::Unit::TestCase
assert_dom_equal expected, _erbout
end
+ def test_fields_for_with_only_object
+ _erbout = ''
+ fields_for(@post) do |f|
+ _erbout.concat f.text_field(:title)
+ _erbout.concat f.text_area(:body)
+ _erbout.concat f.check_box(:secret)
+ end
+
+ expected =
+ "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
+ "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
+ "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />" +
+ "<input name='post[secret]' type='hidden' value='0' />"
+
+ assert_dom_equal expected, _erbout
+ end
+
def test_fields_for_object_with_bracketed_name
_erbout = ''
fields_for("author[post]", @post) do |f|