From cd1d6e8768ae13b11bc343701037b20ad35e6f1e Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Thu, 25 Dec 2008 23:01:17 +0000 Subject: Make ActionController#render(string) work as a shortcut for render :action => string. [#1435] Examples: # Instead of render(:action => 'other_action') render('other_action') Note : Argument must not have any '/' --- actionpack/test/controller/render_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'actionpack/test/controller/render_test.rb') diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index ce9756a060..d097cf496f 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -81,6 +81,10 @@ class TestController < ActionController::Base render :action => "hello_world" end + def render_action_hello_world_as_string + render "hello_world" + end + def render_action_hello_world_with_symbol render :action => :hello_world end @@ -296,6 +300,10 @@ class TestController < ActionController::Base render :action => "hello_world", :layout => "standard" end + def layout_test_with_different_layout_and_string_action + render "hello_world", :layout => "standard" + end + def rendering_without_layout render :action => "hello_world", :layout => false end @@ -743,6 +751,12 @@ class RenderTest < ActionController::TestCase assert_template "test/hello_world" end + def test_render_action_hello_world_as_string + get :render_action_hello_world_as_string + assert_equal "Hello world!", @response.body + assert_template "test/hello_world" + end + def test_render_action_with_symbol get :render_action_hello_world_with_symbol assert_template "test/hello_world" @@ -1043,6 +1057,11 @@ class RenderTest < ActionController::TestCase assert_equal "Hello world!", @response.body end + def test_layout_test_with_different_layout + get :layout_test_with_different_layout_and_string_action + assert_equal "Hello world!", @response.body + end + def test_rendering_without_layout get :rendering_without_layout assert_equal "Hello world!", @response.body -- cgit v1.2.3