From bc4d05b244c78f03ade51d8b95f16dd48ceb63d3 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sun, 23 Nov 2008 13:57:01 -0600 Subject: A back support for legacy TemplateHandler#render API --- actionpack/test/template/render_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'actionpack/test/template') 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 %(\nHello world!\n), @view.render(:file => "test/hello_world.erb", :layout => "layouts/yield") -- cgit v1.2.3