From dcb8b64975832ac75d92104da3c95876e56eec66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 21 Jan 2010 12:12:10 +0100 Subject: Add shortcut test to abstract/render_test.rb --- actionpack/test/abstract/render_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack/test/abstract/render_test.rb') diff --git a/actionpack/test/abstract/render_test.rb b/actionpack/test/abstract/render_test.rb index be0478b638..4bec44c9ae 100644 --- a/actionpack/test/abstract/render_test.rb +++ b/actionpack/test/abstract/render_test.rb @@ -33,6 +33,10 @@ module AbstractController render end + def shortcut + render "template" + end + def template_name render :_template_name => :template_name end @@ -73,6 +77,11 @@ module AbstractController assert_equal "With Default", @controller.response_body end + def test_render_template_through_shortcut + @controller.process(:shortcut) + assert_equal "With Template", @controller.response_body + end + def test_render_template_name @controller.process(:template_name) assert_equal "With Template Name", @controller.response_body -- cgit v1.2.3 From d618b7e3dcf2fe6040f025c02bf29691aefc8a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 22 Jan 2010 17:57:36 +0100 Subject: Ensure strings given to render with slash are rendered relative to the configured _prefix. --- actionpack/test/abstract/render_test.rb | 35 ++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'actionpack/test/abstract/render_test.rb') diff --git a/actionpack/test/abstract/render_test.rb b/actionpack/test/abstract/render_test.rb index 4bec44c9ae..ffd430fa86 100644 --- a/actionpack/test/abstract/render_test.rb +++ b/actionpack/test/abstract/render_test.rb @@ -6,9 +6,16 @@ module AbstractController class ControllerRenderer < AbstractController::Base include AbstractController::Rendering + def _prefix + "renderer" + end + self.view_paths = [ActionView::FixtureResolver.new( "default.erb" => "With Default", "template.erb" => "With Template", + "renderer/string.erb" => "With String", + "renderer/symbol.erb" => "With Symbol", + "string/with_path.erb" => "With String With Path", "some/file.erb" => "With File", "template_name.erb" => "With Template Name" )] @@ -33,8 +40,16 @@ module AbstractController render end - def shortcut - render "template" + def string + render "string" + end + + def string_with_path + render "string/with_path" + end + + def symbol + render :symbol end def template_name @@ -77,9 +92,19 @@ module AbstractController assert_equal "With Default", @controller.response_body end - def test_render_template_through_shortcut - @controller.process(:shortcut) - assert_equal "With Template", @controller.response_body + def test_render_string + @controller.process(:string) + assert_equal "With String", @controller.response_body + end + + def test_render_symbol + @controller.process(:symbol) + assert_equal "With Symbol", @controller.response_body + end + + def test_render_string_with_path + @controller.process(:string_with_path) + assert_equal "With String With Path", @controller.response_body end def test_render_template_name -- cgit v1.2.3