diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-01-16 02:01:57 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-01-16 02:01:57 +0000 |
commit | b812b236876ab7a6bd1f3e58a1aa71847394f3a1 (patch) | |
tree | 28e65251aee0a1007bec37b03c4ae2b5c41ff293 /actionpack/test/controller | |
parent | 8a71f870093ccdfa0b04e318cca0f517576be380 (diff) | |
download | rails-b812b236876ab7a6bd1f3e58a1aa71847394f3a1.tar.gz rails-b812b236876ab7a6bd1f3e58a1aa71847394f3a1.tar.bz2 rails-b812b236876ab7a6bd1f3e58a1aa71847394f3a1.zip |
Make render :partial recognise form builders and use the _form partial. Closes #10814 [djanowski]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8646 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/new_render_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb index e06737ee0b..eb19b2e391 100644 --- a/actionpack/test/controller/new_render_test.rb +++ b/actionpack/test/controller/new_render_test.rb @@ -17,6 +17,9 @@ module NewRenderTestHelper end end +class LabellingFormBuilder < ActionView::Helpers::FormBuilder +end + class NewRenderTestController < ActionController::Base layout :determine_layout @@ -136,7 +139,15 @@ class NewRenderTestController < ActionController::Base def partial_with_locals render :partial => "customer", :locals => { :customer => Customer.new("david") } end + + def partial_with_form_builder + render :partial => ActionView::Helpers::FormBuilder.new(:post, nil, @template, nil, Proc.new {}) + end + def partial_with_form_builder_subclass + render :partial => LabellingFormBuilder.new(:post, nil, @template, nil, Proc.new {}) + end + def partial_collection render :partial => "customer", :collection => [ Customer.new("david"), Customer.new("mary") ] end @@ -685,6 +696,18 @@ EOS assert_equal "Hello: david", @response.body end + def test_partial_with_form_builder + get :partial_with_form_builder + assert_match(/<label/, @response.body) + assert_template('test/_form') + end + + def test_partial_with_form_builder_subclass + get :partial_with_form_builder_subclass + assert_match(/<label/, @response.body) + assert_template('test/_labelling_form') + end + def test_partial_collection get :partial_collection assert_equal "Hello: davidHello: mary", @response.body |