diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-03 04:16:58 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-03 04:16:58 +0000 |
commit | 7f6c5a56548233b8b02b09a1ac28d7b509bd26f7 (patch) | |
tree | 70de50ec253cad5b935dd6a270933f1ff407af48 /actionpack/test/template | |
parent | 9a39a86f65d2fd42d15275dabeb3808bc623649c (diff) | |
download | rails-7f6c5a56548233b8b02b09a1ac28d7b509bd26f7.tar.gz rails-7f6c5a56548233b8b02b09a1ac28d7b509bd26f7.tar.bz2 rails-7f6c5a56548233b8b02b09a1ac28d7b509bd26f7.zip |
Set ActionView::Base.default_form_builder once rather than passing the :builder option to every form or overriding the form helper methods.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5422 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index c177a3db22..a7ceb6b30f 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -396,7 +396,31 @@ class FormHelperTest < Test::Unit::TestCase assert_dom_equal expected, _erbout end - + + def test_default_form_builder + old_default_form_builder, ActionView::Base.default_form_builder = + ActionView::Base.default_form_builder, LabelledFormBuilder + + _erbout = '' + form_for(:post, @post) do |f| + _erbout.concat f.text_field(:title) + _erbout.concat f.text_area(:body) + _erbout.concat f.check_box(:secret) + end + + expected = + "<form action='http://www.example.com' method='post'>" + + "<label for='title'>Title:</label> <input name='post[title]' size='30' type='text' id='post_title' value='Hello World' /><br/>" + + "<label for='body'>Body:</label> <textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea><br/>" + + "<label for='secret'>Secret:</label> <input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />" + + "<input name='post[secret]' type='hidden' value='0' /><br/>" + + "</form>" + + assert_dom_equal expected, _erbout + ensure + ActionView::Base.default_form_builder = old_default_form_builder + end + # Perhaps this test should be moved to prototype helper tests. def test_remote_form_for_with_labelled_builder self.extend ActionView::Helpers::PrototypeHelper |