diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 457b9e8..ff69970 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -978,6 +978,7 @@ module ActionController #:nodoc: # Clears the rendered results, allowing for another render to be performed. def erase_render_results #:nodoc: + response.template.send(:_first_render=, nil) response.body = nil @performed_render = false end diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index af7b5dd..370febc 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -315,6 +315,11 @@ class TestController < ActionController::Base render :text => "Hi web users! #{@stuff}" end + def render_to_string_with_template_and_render_template + @foo = render_to_string :template => "test/hello_world" + render :template => "test/render_to_string_test" + end + def rendering_with_conflicting_local_vars @name = "David" def @template.name() nil end @@ -1421,3 +1426,18 @@ class RenderingLoggingTest < Test::Unit::TestCase assert_equal "Rendering test/hello_world", logged[1] end end + +class ActionControllerAssertionsTest < Test::Unit::TestCase + + def setup + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + @controller = TestController.new + end + + def test_assert_template_should_ignore_templates_in_render_to_string + get :render_to_string_with_template_and_render_template + assert_nothing_raised { assert_template "test/render_to_string_test" } + end + +end