From f57ee365e154ce6d15cd168112d94a9a8ff27094 Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 30 May 2005 07:51:02 +0000 Subject: render(:text), render(:partial), and render(:nothing) always default to :layout => false. This also fixes send_file, which was applying a layout if one existed for the current action. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1369 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/new_render_test.rb | 13 ++++++++++++- actionpack/test/controller/send_file_test.rb | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb index ad1415aca3..3d1e6e794b 100644 --- a/actionpack/test/controller/new_render_test.rb +++ b/actionpack/test/controller/new_render_test.rb @@ -75,6 +75,10 @@ class TestController < ActionController::Base render :partial => true end + def partial_only_with_layout + render :partial => "partial_only", :layout => nil + end + def hello_in_a_string @customers = [ Customer.new("david"), Customer.new("mary") ] render :text => "How's there? #{render_to_string("test/list")}" @@ -89,7 +93,9 @@ class TestController < ActionController::Base private def determine_layout case action_name - when "layout_test", "rendering_without_layout", "rendering_nothing_on_layout" + when "layout_test", "rendering_without_layout", + "rendering_nothing_on_layout", "render_text_hello_world", + "partial_only", "partial_only_with_layout" "layouts/standard" when "builder_layout_test" "layouts/builder" @@ -219,6 +225,11 @@ class RenderTest < Test::Unit::TestCase assert_equal "only partial", @response.body end + def test_partial_only_with_layout + get :partial_only_with_layout + assert_equal "only partial", @response.body + end + def test_render_to_string get :hello_in_a_string assert_equal "How's there? Hello: davidHello: mary", @response.body diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb index d18d15b18a..b7674bda60 100644 --- a/actionpack/test/controller/send_file_test.rb +++ b/actionpack/test/controller/send_file_test.rb @@ -10,6 +10,7 @@ end class SendFileController < ActionController::Base include TestFileUtils + layout "layouts/standard" # to make sure layouts don't interfere attr_writer :options def options() @options ||= {} end @@ -20,6 +21,7 @@ class SendFileController < ActionController::Base def rescue_action(e) raise end end +SendFileController.template_root = File.dirname(__FILE__) + "/../fixtures/" class SendFileTest < Test::Unit::TestCase include TestFileUtils -- cgit v1.2.3