From 81e814adfad6d4bba1af5f70a5a409f6d71f8f6c Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Fri, 20 Mar 2009 16:13:13 -0700 Subject: Working on being able to render :text with layouts --- actionpack/test/new_base/render_text_test.rb | 34 +++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/new_base/render_text_test.rb b/actionpack/test/new_base/render_text_test.rb index f845b4c9cc..61ec6e05df 100644 --- a/actionpack/test/new_base/render_text_test.rb +++ b/actionpack/test/new_base/render_text_test.rb @@ -3,9 +3,13 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper") module HappyPath class RenderTextController < ActionController::Base2 + self.view_paths = [ActionView::FixtureTemplate::FixturePath.new( + "layouts/application.html.erb" => "<%= yield %>, I'm here!", + "layouts/greetings.html.erb" => "<%= yield %>, I wish thee well." + )] + def render_hello_world_from_variable - @person = "david" - render :text => "hello #{@person}" + render :text => "hello david" end def render_custom_code @@ -27,10 +31,18 @@ module HappyPath def render_text_with_false render :text => false end + + def render_text_with_layout + render :text => "hello world", :layout => true + end + + def render_text_with_custom_layout + render :text => "hello world", :layout => "greetings" + end end class TestSimpleTextRender < SimpleRouteCase - describe "Rendering text from a action with default options" + describe "Rendering text from a action with default options renders the text without the layout" get "/happy_path/render_text/render_hello_world_from_variable" assert_body "hello david" @@ -68,4 +80,20 @@ module HappyPath assert_body "false" assert_status 200 end + + class TestTextRenderWithLayoutTrue < SimpleRouteCase + describe "Rendering text with :layout => true" + + get "/happy_path/render_text/render_text_with_layout" + assert_body "hello world, I'm here!" + assert_status 200 + end + + class TestTextRenderWithCustomLayout < SimpleRouteCase + describe "Rendering text with :layout => 'greetings'" + + get "/happy_path/render_text/render_text_with_custom_layout" + assert_body "hello world, I wish thee well." + assert_status 200 + end end \ No newline at end of file -- cgit v1.2.3