diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-03-03 04:01:35 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-03-03 04:01:35 +0000 |
commit | 51b6619d4e78d9948952dab4709274ab57f41206 (patch) | |
tree | bab7a4d988c9349f4d8241e38e09f30d62b0049b /actionpack/test/controller | |
parent | 10d9d0b6fe023df1be0d87ca95bb739bb7eb30ba (diff) | |
download | rails-51b6619d4e78d9948952dab4709274ab57f41206.tar.gz rails-51b6619d4e78d9948952dab4709274ab57f41206.tar.bz2 rails-51b6619d4e78d9948952dab4709274ab57f41206.zip |
Refactor partial rendering into a PartialTemplate class. [Pratik]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8976 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/custom_handler_test.rb | 6 | ||||
-rw-r--r-- | actionpack/test/controller/layout_test.rb | 4 | ||||
-rw-r--r-- | actionpack/test/controller/new_render_test.rb | 20 |
3 files changed, 24 insertions, 6 deletions
diff --git a/actionpack/test/controller/custom_handler_test.rb b/actionpack/test/controller/custom_handler_test.rb index 932b8c15c3..cdde00cccc 100644 --- a/actionpack/test/controller/custom_handler_test.rb +++ b/actionpack/test/controller/custom_handler_test.rb @@ -5,9 +5,9 @@ class CustomHandler < ActionView::TemplateHandler @view = view end - def render( template, local_assigns ) - [ template, - local_assigns, + def render( template ) + [ template.source, + template.locals, @view ] end end diff --git a/actionpack/test/controller/layout_test.rb b/actionpack/test/controller/layout_test.rb index 11ad4a20af..56d7f69774 100644 --- a/actionpack/test/controller/layout_test.rb +++ b/actionpack/test/controller/layout_test.rb @@ -35,8 +35,8 @@ class MabView < ActionView::TemplateHandler def initialize(view) end - def render(text, locals = {}) - text + def render(template) + template.source end end diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb index 928c46cb6d..0f14de54b1 100644 --- a/actionpack/test/controller/new_render_test.rb +++ b/actionpack/test/controller/new_render_test.rb @@ -146,6 +146,14 @@ class NewRenderTestController < ActionController::Base def partial_collection render :partial => "customer", :collection => [ Customer.new("david"), Customer.new("mary") ] end + + def partial_collection_with_spacer + render :partial => "customer", :spacer_template => "partial_only", :collection => [ Customer.new("david"), Customer.new("mary") ] + end + + def partial_collection_with_counter + render :partial => "customer_counter", :collection => [ Customer.new("david"), Customer.new("mary") ] + end def partial_collection_with_locals render :partial => "customer_greeting", :collection => [ Customer.new("david"), Customer.new("mary") ], :locals => { :greeting => "Bonjour" } @@ -712,11 +720,21 @@ EOS get :partial_collection assert_equal "Hello: davidHello: mary", @response.body end - + + def test_partial_collection_with_counter + get :partial_collection_with_counter + assert_equal "david1mary2", @response.body + end + def test_partial_collection_with_locals get :partial_collection_with_locals assert_equal "Bonjour: davidBonjour: mary", @response.body end + + def test_partial_collection_with_spacer + get :partial_collection_with_spacer + assert_equal "Hello: davidonly partialHello: mary", @response.body + end def test_partial_collection_shorthand_with_locals get :partial_collection_shorthand_with_locals |