From 4238666627a6b319c19f22ee279d15284ed5f245 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Sun, 26 Mar 2006 19:45:56 +0000 Subject: Change #form_for and #fields_for so that the second argument is not required [Dave Thomas] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4047 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/form_helper_test.rb | 39 +++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index cfeff6d7a7..acff699535 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -232,6 +232,26 @@ class FormHelperTest < Test::Unit::TestCase assert_dom_equal expected, _erbout end + def test_form_for_without_object + _erbout = '' + + form_for(:post) do |f| + _erbout.concat f.text_field(:title) + _erbout.concat f.text_area(:body) + _erbout.concat f.check_box(:secret) + end + + expected = + "
" + + "" + + "" + + "" + + "" + + "
" + + assert_dom_equal expected, _erbout + end + def test_fields_for _erbout = '' @@ -249,7 +269,24 @@ class FormHelperTest < Test::Unit::TestCase assert_dom_equal expected, _erbout end - + + def test_fields_for_without_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 = + "" + + "" + + "" + + "" + + assert_dom_equal expected, _erbout + end + def test_form_builder_does_not_have_form_for_method assert ! ActionView::Helpers::FormBuilder.instance_methods.include?('form_for') end -- cgit v1.2.3