aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
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