aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2009-03-20 16:13:13 -0700
committerYehuda Katz <wycats@gmail.com>2009-03-23 10:23:14 -0700
commit81e814adfad6d4bba1af5f70a5a409f6d71f8f6c (patch)
treea1dfa746191d7509f6f695b2e99d5a7f79278b91 /actionpack/test
parent90c079a7814a9a996c8cbe353015c080fafce2bc (diff)
downloadrails-81e814adfad6d4bba1af5f70a5a409f6d71f8f6c.tar.gz
rails-81e814adfad6d4bba1af5f70a5a409f6d71f8f6c.tar.bz2
rails-81e814adfad6d4bba1af5f70a5a409f6d71f8f6c.zip
Working on being able to render :text with layouts
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/new_base/render_text_test.rb34
1 files changed, 31 insertions, 3 deletions
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