Skip to content

Commit

Permalink
Dont raise deprecation warning on render :action => "stuff"
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4975 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Sep 4, 2006
1 parent ea83146 commit 653bfe9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 30 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_controller/base.rb
Expand Up @@ -757,9 +757,9 @@ def render_to_string(options = nil, &block) #:doc:
def render_action(action_name, status = nil, with_layout = true) #:nodoc:
template = default_template_name(action_name.to_s)
if with_layout && !template_exempt_from_layout?(template)
render_with_layout(template, status)
render_with_layout(:file => template, :status => status, :use_full_path => true, :layout => true)
else
render_without_layout(template, status)
render_without_layout(:file => template, :status => status, :use_full_path => true)
end
end

Expand Down
45 changes: 17 additions & 28 deletions actionpack/test/controller/render_test.rb
Expand Up @@ -121,38 +121,38 @@ def setup
end

def test_simple_show
assert_not_deprecated { get :hello_world }
get :hello_world
assert_response 200
assert_template "test/hello_world"
end

def test_do_with_render
assert_deprecated_render { get :render_hello_world }
get :render_hello_world
assert_template "test/hello_world"
end

def test_do_with_render_from_variable
assert_not_deprecated { get :render_hello_world_from_variable }
get :render_hello_world_from_variable
assert_equal "hello david", @response.body
end

def test_do_with_render_action
assert_deprecated_render { get :render_action_hello_world }
get :render_action_hello_world
assert_template "test/hello_world"
end

def test_do_with_render_action_with_symbol
assert_deprecated_render { get :render_action_hello_world_with_symbol }
get :render_action_hello_world_with_symbol
assert_template "test/hello_world"
end

def test_do_with_render_text
assert_not_deprecated { get :render_text_hello_world }
get :render_text_hello_world
assert_equal "hello world", @response.body
end

def test_do_with_render_custom_code
assert_not_deprecated { get :render_custom_code }
get :render_custom_code
assert_response 404
end

Expand Down Expand Up @@ -184,22 +184,22 @@ def test_access_to_request_in_view
end

def test_render_xml
assert_deprecated_render { get :render_xml_hello }
get :render_xml_hello
assert_equal "<html>\n <p>Hello David</p>\n<p>This is grand!</p>\n</html>\n", @response.body
end

def test_render_xml_with_default
assert_not_deprecated { get :greeting }
get :greeting
assert_equal "<p>This is grand!</p>\n", @response.body
end

def test_layout_rendering
assert_deprecated_render { get :layout_test }
get :layout_test
assert_equal "<html>Hello world!</html>", @response.body
end

def test_render_xml_with_layouts
assert_deprecated_render { get :builder_layout_test }
get :builder_layout_test
assert_equal "<wrapper>\n<html>\n <p>Hello </p>\n<p>This is grand!</p>\n</html>\n</wrapper>\n", @response.body
end

Expand All @@ -209,17 +209,17 @@ def test_render_xml_with_layouts
# end

def test_partial_only
assert_not_deprecated { get :partial_only }
get :partial_only
assert_equal "only partial", @response.body
end

def test_render_to_string
assert_not_deprecated { get :hello_in_a_string }
get :hello_in_a_string
assert_equal "How's there? goodbyeHello: davidHello: marygoodbye\n", @response.body
end

def test_render_to_string_resets_assigns
assert_not_deprecated { get :render_to_string_test }
get :render_to_string_test
assert_equal "The value of foo is: ::this is a test::\n", @response.body
end

Expand All @@ -230,28 +230,17 @@ def test_nested_rendering
end

def test_accessing_params_in_template
assert_not_deprecated do
get :accessing_params_in_template, :name => "David"
end
get :accessing_params_in_template, :name => "David"
assert_equal "Hello: David", @response.body
end

def test_accessing_local_assigns_in_inline_template
assert_not_deprecated do
get :accessing_local_assigns_in_inline_template, :local_name => "Local David"
end
get :accessing_local_assigns_in_inline_template, :local_name => "Local David"
assert_equal "Goodbye, Local David", @response.body
end

def test_accessing_local_assigns_in_inline_template_with_string_keys
assert_not_deprecated do
get :accessing_local_assigns_in_inline_template_with_string_keys, :local_name => "Local David"
end
get :accessing_local_assigns_in_inline_template_with_string_keys, :local_name => "Local David"
assert_equal "Goodbye, Local David", @response.body
end

protected
def assert_deprecated_render(&block)
assert_deprecated(/render/, &block)
end
end

0 comments on commit 653bfe9

Please sign in to comment.