diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-04-28 23:02:39 -0700 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-04-28 23:02:39 -0700 |
commit | beba8267c96a3dbc1f505ecc099dbf14db8dde4c (patch) | |
tree | 22d28096089a333e16b14111f6cd484f5ab4dcfd /actionpack/test/template/form_helper_test.rb | |
parent | 7dc83f78232a6dfcdd70292e831403933f57347b (diff) | |
download | rails-beba8267c96a3dbc1f505ecc099dbf14db8dde4c.tar.gz rails-beba8267c96a3dbc1f505ecc099dbf14db8dde4c.tar.bz2 rails-beba8267c96a3dbc1f505ecc099dbf14db8dde4c.zip |
Lazy load `default_form_builder` if it's passed as a string
closes #3341
Diffstat (limited to 'actionpack/test/template/form_helper_test.rb')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 17 |
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 7eeede7087..3f459bad2e 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -2033,6 +2033,23 @@ class FormHelperTest < ActionView::TestCase ActionView::Base.default_form_builder = old_default_form_builder end + def test_lazy_loading_default_form_builder + old_default_form_builder, ActionView::Base.default_form_builder = + ActionView::Base.default_form_builder, "FormHelperTest::LabelledFormBuilder" + + form_for(@post) do |f| + concat f.text_field(:title) + end + + expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do + "<label for='title'>Title:</label> <input name='post[title]' type='text' id='post_title' value='Hello World' /><br/>" + end + + assert_dom_equal expected, output_buffer + ensure + ActionView::Base.default_form_builder = old_default_form_builder + end + def test_fields_for_with_labelled_builder output_buffer = fields_for(:post, @post, :builder => LabelledFormBuilder) do |f| concat f.text_field(:title) |