aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-05-30 07:51:02 +0000
committerJamis Buck <jamis@37signals.com>2005-05-30 07:51:02 +0000
commitf57ee365e154ce6d15cd168112d94a9a8ff27094 (patch)
tree54948d6d27c59b5b85734eed660a78cf4ea772cb /actionpack/test/controller
parent613260606b006427e9ca8871ef0f2e294940c03d (diff)
downloadrails-f57ee365e154ce6d15cd168112d94a9a8ff27094.tar.gz
rails-f57ee365e154ce6d15cd168112d94a9a8ff27094.tar.bz2
rails-f57ee365e154ce6d15cd168112d94a9a8ff27094.zip
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
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/new_render_test.rb13
-rw-r--r--actionpack/test/controller/send_file_test.rb2
2 files changed, 14 insertions, 1 deletions
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 "<html>only partial</html>", @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