aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/new_base/render_text_test.rb
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2009-03-20 18:38:03 -0700
committerYehuda Katz <wycats@gmail.com>2009-03-23 10:23:14 -0700
commitab17ecfe5d97d5026d67688ddefe11a458701076 (patch)
tree1aa5e9ba238e0b9a2cc9e7bfc19a750ebc5ebd0b /actionpack/test/new_base/render_text_test.rb
parentc6123c37030b715d088860ea1ca79060659b0e3c (diff)
downloadrails-ab17ecfe5d97d5026d67688ddefe11a458701076.tar.gz
rails-ab17ecfe5d97d5026d67688ddefe11a458701076.tar.bz2
rails-ab17ecfe5d97d5026d67688ddefe11a458701076.zip
Finished implementing :layout for most of the render options
Diffstat (limited to 'actionpack/test/new_base/render_text_test.rb')
-rw-r--r--actionpack/test/new_base/render_text_test.rb38
1 files changed, 27 insertions, 11 deletions
diff --git a/actionpack/test/new_base/render_text_test.rb b/actionpack/test/new_base/render_text_test.rb
index f91e6bd644..b80a9b4a79 100644
--- a/actionpack/test/new_base/render_text_test.rb
+++ b/actionpack/test/new_base/render_text_test.rb
@@ -2,7 +2,15 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module HappyPath
- class RenderTextController < ActionController::Base2
+ class RenderTextWithoutLayoutsController < ActionController::Base2
+ self.view_paths = [ActionView::FixtureTemplate::FixturePath.new]
+
+ def render_hello_world
+ render :text => "hello david"
+ end
+ end
+
+ class RenderTextWithLayoutsController < 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."
@@ -49,10 +57,18 @@ module HappyPath
end
end
- class TestSimpleTextRender < SimpleRouteCase
+ class TestSimpleTextRenderWithNoLayout < SimpleRouteCase
+ describe "Rendering text from a action with default options renders the text with the layout"
+
+ get "/happy_path/render_text_without_layouts/render_hello_world"
+ assert_body "hello david"
+ assert_status 200
+ end
+
+ class TestSimpleTextRenderWithLayout < SimpleRouteCase
describe "Rendering text from a action with default options renders the text without the layout"
- get "/happy_path/render_text/render_hello_world"
+ get "/happy_path/render_text_with_layouts/render_hello_world"
assert_body "hello david"
assert_status 200
end
@@ -60,7 +76,7 @@ module HappyPath
class TestTextRenderWithStatus < SimpleRouteCase
describe "Rendering text, while also providing a custom status code"
- get "/happy_path/render_text/render_custom_code"
+ get "/happy_path/render_text_with_layouts/render_custom_code"
assert_body "hello world"
assert_status 404
end
@@ -68,7 +84,7 @@ module HappyPath
class TestTextRenderWithNil < SimpleRouteCase
describe "Rendering text with nil returns a single space character"
- get "/happy_path/render_text/render_text_with_nil"
+ get "/happy_path/render_text_with_layouts/render_text_with_nil"
assert_body " "
assert_status 200
end
@@ -76,7 +92,7 @@ module HappyPath
class TestTextRenderWithNilAndStatus < SimpleRouteCase
describe "Rendering text with nil and custom status code returns a single space character with the status"
- get "/happy_path/render_text/render_text_with_nil_and_status"
+ get "/happy_path/render_text_with_layouts/render_text_with_nil_and_status"
assert_body " "
assert_status 403
end
@@ -84,7 +100,7 @@ module HappyPath
class TestTextRenderWithFalse < SimpleRouteCase
describe "Rendering text with false returns the string 'false'"
- get "/happy_path/render_text/render_text_with_false"
+ get "/happy_path/render_text_with_layouts/render_text_with_false"
assert_body "false"
assert_status 200
end
@@ -92,7 +108,7 @@ module HappyPath
class TestTextRenderWithLayoutTrue < SimpleRouteCase
describe "Rendering text with :layout => true"
- get "/happy_path/render_text/render_text_with_layout"
+ get "/happy_path/render_text_with_layouts/render_text_with_layout"
assert_body "hello world, I'm here!"
assert_status 200
end
@@ -100,7 +116,7 @@ module HappyPath
class TestTextRenderWithCustomLayout < SimpleRouteCase
describe "Rendering text with :layout => 'greetings'"
- get "/happy_path/render_text/render_text_with_custom_layout"
+ get "/happy_path/render_text_with_layouts/render_text_with_custom_layout"
assert_body "hello world, I wish thee well."
assert_status 200
end
@@ -108,7 +124,7 @@ module HappyPath
class TestTextRenderWithLayoutFalse < SimpleRouteCase
describe "Rendering text with :layout => false"
- get "/happy_path/render_text/render_text_with_layout_false"
+ get "/happy_path/render_text_with_layouts/render_text_with_layout_false"
assert_body "hello world"
assert_status 200
end
@@ -116,7 +132,7 @@ module HappyPath
class TestTextRenderWithLayoutNil < SimpleRouteCase
describe "Rendering text with :layout => nil"
- get "/happy_path/render_text/render_text_with_layout_nil"
+ get "/happy_path/render_text_with_layouts/render_text_with_layout_nil"
assert_body "hello world"
assert_status 200
end