aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-11-23 13:57:01 -0600
committerJoshua Peek <josh@joshpeek.com>2008-11-23 13:57:01 -0600
commitbc4d05b244c78f03ade51d8b95f16dd48ceb63d3 (patch)
treef261b5cc22a91ad39e415d31ccbdc98fd3a5e438 /actionpack/test/template
parent2c01f2b4e9d4a95bb2baca8ae57209eb10aa78b2 (diff)
downloadrails-bc4d05b244c78f03ade51d8b95f16dd48ceb63d3.tar.gz
rails-bc4d05b244c78f03ade51d8b95f16dd48ceb63d3.tar.bz2
rails-bc4d05b244c78f03ade51d8b95f16dd48ceb63d3.zip
A back support for legacy TemplateHandler#render API
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/render_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 0323c33b95..b316d5c23e 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -175,6 +175,17 @@ class ViewRenderTest < Test::Unit::TestCase
assert_equal 'source: "Hello, <%= name %>!"', @view.render(:inline => "Hello, <%= name %>!", :locals => { :name => "Josh" }, :type => :foo)
end
+ class LegacyHandler < ActionView::TemplateHandler
+ def render(template, local_assigns)
+ "source: #{template.source}; locals: #{local_assigns.inspect}"
+ end
+ end
+
+ def test_render_legacy_handler_with_custom_type
+ ActionView::Template.register_template_handler :foo, LegacyHandler
+ assert_equal 'source: Hello, <%= name %>!; locals: {:name=>"Josh"}', @view.render(:inline => "Hello, <%= name %>!", :locals => { :name => "Josh" }, :type => :foo)
+ end
+
def test_render_with_layout
assert_equal %(<title></title>\nHello world!\n),
@view.render(:file => "test/hello_world.erb", :layout => "layouts/yield")