diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-05-20 21:15:06 +0200 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-05-20 21:15:06 +0200 |
commit | c03b0ca7eb7e73587005e1440bf90cd01ed10aa5 (patch) | |
tree | 508196be70cad42b4debce6103fb5f5e2b3c5cbe /actionpack/test/new_base/render_text_test.rb | |
parent | 6761759a90c08b9db8d5720a8ee4c4329a547caf (diff) | |
download | rails-c03b0ca7eb7e73587005e1440bf90cd01ed10aa5.tar.gz rails-c03b0ca7eb7e73587005e1440bf90cd01ed10aa5.tar.bz2 rails-c03b0ca7eb7e73587005e1440bf90cd01ed10aa5.zip |
Replace the class level Rack::Test DSL with the regular integration tests DSL
Diffstat (limited to 'actionpack/test/new_base/render_text_test.rb')
-rw-r--r-- | actionpack/test/new_base/render_text_test.rb | 151 |
1 files changed, 72 insertions, 79 deletions
diff --git a/actionpack/test/new_base/render_text_test.rb b/actionpack/test/new_base/render_text_test.rb index 39f2f7abbf..69594e4b64 100644 --- a/actionpack/test/new_base/render_text_test.rb +++ b/actionpack/test/new_base/render_text_test.rb @@ -11,15 +11,7 @@ module RenderText render :text => "hello david" end end - - class TestSimpleTextRenderWithNoLayout < SimpleRouteCase - describe "Rendering text from a action with default options renders the text with the layout" - - get "/render_text/simple" - assert_body "hello david" - assert_status 200 - end - + class WithLayoutController < ::ApplicationController self.view_paths = [ActionView::Template::FixturePath.new( "layouts/application.html.erb" => "<%= yield %>, I'm here!", @@ -73,76 +65,77 @@ module RenderText end end - class TestSimpleTextRenderWithLayout < SimpleRouteCase - describe "Rendering text from a action with default options renders the text without the layout" - - get "/render_text/with_layout" - assert_body "hello david" - assert_status 200 - end - - class TestTextRenderWithStatus < SimpleRouteCase - describe "Rendering text, while also providing a custom status code" - - get "/render_text/with_layout/custom_code" - assert_body "hello world" - assert_status 404 - end - - class TestTextRenderWithNil < SimpleRouteCase - describe "Rendering text with nil returns a single space character" - - get "/render_text/with_layout/with_nil" - assert_body " " - assert_status 200 - end - - class TestTextRenderWithNilAndStatus < SimpleRouteCase - describe "Rendering text with nil and custom status code returns a single space character with the status" - - get "/render_text/with_layout/with_nil_and_status" - assert_body " " - assert_status 403 - end - - class TestTextRenderWithFalse < SimpleRouteCase - describe "Rendering text with false returns the string 'false'" - - get "/render_text/with_layout/with_false" - assert_body "false" - assert_status 200 - end - - class TestTextRenderWithLayoutTrue < SimpleRouteCase - describe "Rendering text with :layout => true" - - get "/render_text/with_layout/with_layout_true" - assert_body "hello world, I'm here!" - assert_status 200 - end - - class TestTextRenderWithCustomLayout < SimpleRouteCase - describe "Rendering text with :layout => 'greetings'" - - get "/render_text/with_layout/with_custom_layout" - assert_body "hello world, I wish thee well." - assert_status 200 - end - - class TestTextRenderWithLayoutFalse < SimpleRouteCase - describe "Rendering text with :layout => false" - - get "/render_text/with_layout/with_layout_false" - assert_body "hello world" - assert_status 200 - end - - class TestTextRenderWithLayoutNil < SimpleRouteCase - describe "Rendering text with :layout => nil" - - get "/render_text/with_layout/with_layout_nil" - assert_body "hello world" - assert_status 200 + class RenderTextTest < SimpleRouteCase + describe "Rendering text using render :text" + + test "rendering text from a action with default options renders the text with the layout" do + get "/render_text/simple" + assert_body "hello david" + assert_status 200 + end + + test "rendering text from a action with default options renders the text without the layout" do + get "/render_text/with_layout" + + assert_body "hello david" + assert_status 200 + end + + test "rendering text, while also providing a custom status code" do + get "/render_text/with_layout/custom_code" + + assert_body "hello world" + assert_status 404 + end + + test "rendering text with nil returns a single space character" do + get "/render_text/with_layout/with_nil" + + assert_body " " + assert_status 200 + end + + test "Rendering text with nil and custom status code returns a single space character with the status" do + get "/render_text/with_layout/with_nil_and_status" + + assert_body " " + assert_status 403 + end + + test "rendering text with false returns the string 'false'" do + get "/render_text/with_layout/with_false" + + assert_body "false" + assert_status 200 + end + + test "rendering text with :layout => true" do + get "/render_text/with_layout/with_layout_true" + + assert_body "hello world, I'm here!" + assert_status 200 + end + + test "rendering text with :layout => 'greetings'" do + get "/render_text/with_layout/with_custom_layout" + + assert_body "hello world, I wish thee well." + assert_status 200 + end + + test "rendering text with :layout => false" do + get "/render_text/with_layout/with_layout_false" + + assert_body "hello world" + assert_status 200 + end + + test "rendering text with :layout => nil" do + get "/render_text/with_layout/with_layout_nil" + + assert_body "hello world" + assert_status 200 + end end end |