diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/new_render_test.rb | 23 | ||||
-rw-r--r-- | actionpack/test/fixtures/test/_form.erb | 1 | ||||
-rw-r--r-- | actionpack/test/fixtures/test/_labelling_form.erb | 1 |
3 files changed, 25 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 diff --git a/actionpack/test/fixtures/test/_form.erb b/actionpack/test/fixtures/test/_form.erb new file mode 100644 index 0000000000..01107f1cb2 --- /dev/null +++ b/actionpack/test/fixtures/test/_form.erb @@ -0,0 +1 @@ +<%= form.label :title %> diff --git a/actionpack/test/fixtures/test/_labelling_form.erb b/actionpack/test/fixtures/test/_labelling_form.erb new file mode 100644 index 0000000000..1b95763165 --- /dev/null +++ b/actionpack/test/fixtures/test/_labelling_form.erb @@ -0,0 +1 @@ +<%= labelling_form.label :title %> |