From bd558ef98e17e27da51aee77fe50ef2cd129bb6e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 21 Jul 2005 07:14:35 +0000 Subject: Improved rendering speed on complicated templates by up to 25% #1234 [Stephan Kaes]. This did necessasitate a change to the internals of ActionView#render_template that now has four parameters. Developers of custom view handlers (like Amrita) need to update for that. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1874 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/custom_handler_test.rb | 4 ++-- actionpack/test/controller/new_render_test.rb | 22 ++++++++++++++++------ actionpack/test/controller/test_test.rb | 1 + 3 files changed, 19 insertions(+), 8 deletions(-) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/custom_handler_test.rb b/actionpack/test/controller/custom_handler_test.rb index 8939d19166..38e675ffed 100644 --- a/actionpack/test/controller/custom_handler_test.rb +++ b/actionpack/test/controller/custom_handler_test.rb @@ -19,7 +19,7 @@ class CustomHandlerTest < Test::Unit::TestCase end def test_custom_render - result = @view.render_template( "foo", "hello <%= one %>", "one" => "two" ) + result = @view.render_template( "foo", "hello <%= one %>", nil, "one" => "two" ) assert_equal( [ "hello <%= one %>", { "one" => "two" }, @view ], result ) @@ -27,7 +27,7 @@ class CustomHandlerTest < Test::Unit::TestCase def test_unhandled_extension # uses the ERb handler by default if the extension isn't recognized - result = @view.render_template( "bar", "hello <%= one %>", "one" => "two" ) + result = @view.render_template( "bar", "hello <%= one %>", nil, "one" => "two" ) assert_equal "hello two", result end end diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb index 67529a825e..105e5ec06d 100644 --- a/actionpack/test/controller/new_render_test.rb +++ b/actionpack/test/controller/new_render_test.rb @@ -114,6 +114,11 @@ class NewRenderTestController < ActionController::Base redirect_to :action => "double_render" end + def rendering_with_conflicting_local_vars + @name = "David" + render :action => "potential_conflicts" + end + def rescue_action(e) raise end private @@ -236,11 +241,6 @@ class NewRenderTest < Test::Unit::TestCase assert_equal "\n\n

Hello

\n

This is grand!

\n\n
\n", @response.body end - # def test_partials_list - # get :partials_list - # assert_equal "goodbyeHello: davidHello: marygoodbye\n", @response.body - # end - def test_partial_only get :partial_only assert_equal "only partial", @response.body @@ -287,4 +287,14 @@ class NewRenderTest < Test::Unit::TestCase def test_render_and_redirect assert_raises(ActionController::DoubleRenderError) { get :render_and_redirect } end -end + + def test_rendering_with_conflicting_local_vars + get :rendering_with_conflicting_local_vars + assert_equal("First: David\nSecond: Stephan\nThird: David\nFourth: David\nFifth: ", @response.body) + end + + # def test_partials_list + # get :partials_list + # assert_equal "goodbyeHello: davidHello: marygoodbye\n", @response.body + # end +end \ No newline at end of file diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 0ebd6bc472..b27f3e9423 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -5,6 +5,7 @@ class TestTest < Test::Unit::TestCase class TestController < ActionController::Base def set_flash flash["test"] = ">#{flash["test"]}<" + render :text => 'ignore me' end def test_params -- cgit v1.2.3