aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-04-29 17:32:39 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-01 17:31:02 -0700
commit49834e088bf8d02a4f75793a42868f2aea8749a4 (patch)
tree314643bcdaabd64780f027756ca4710c6a2d72ac /actionpack/test
parent0c3d9bc4c2b329cb754bfed1e465f99d058e1193 (diff)
downloadrails-49834e088bf8d02a4f75793a42868f2aea8749a4.tar.gz
rails-49834e088bf8d02a4f75793a42868f2aea8749a4.tar.bz2
rails-49834e088bf8d02a4f75793a42868f2aea8749a4.zip
Support implicit render and blank render
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/new_base/render_implicit_action_test.rb32
-rw-r--r--actionpack/test/new_base/render_test.rb18
-rw-r--r--actionpack/test/new_base/test_helper.rb20
3 files changed, 54 insertions, 16 deletions
diff --git a/actionpack/test/new_base/render_implicit_action_test.rb b/actionpack/test/new_base/render_implicit_action_test.rb
index 3afa444e3e..58f5cec181 100644
--- a/actionpack/test/new_base/render_implicit_action_test.rb
+++ b/actionpack/test/new_base/render_implicit_action_test.rb
@@ -4,25 +4,25 @@ module RenderImplicitAction
class SimpleController < ::ApplicationController
self.view_paths = [ActionView::Template::FixturePath.new(
"render_implicit_action/simple/hello_world.html.erb" => "Hello world!",
- "render_implicit_action/simple/hyphen-ated.html.erb" => "Hello hyphen-ated"
+ "render_implicit_action/simple/hyphen-ated.html.erb" => "Hello hyphen-ated!"
)]
def hello_world() end
end
- # class TestImplicitRender < SimpleRouteCase
- # describe "render a simple action with new explicit call to render"
- #
- # get "/render_implicit_action/simple/hello_world"
- # assert_body "Hello world!"
- # assert_status 200
- # end
- #
- # class TestImplicitWithSpecialCharactersRender < SimpleRouteCase
- # describe "render an action with a missing method and has special characters"
- #
- # get "/render_implicit_action/simple/hyphen-ated"
- # assert_body "Hello hyphen-ated!"
- # assert_status 200
- # end
+ class TestImplicitRender < SimpleRouteCase
+ describe "render a simple action with new explicit call to render"
+
+ get "/render_implicit_action/simple/hello_world"
+ assert_body "Hello world!"
+ assert_status 200
+ end
+
+ class TestImplicitWithSpecialCharactersRender < SimpleRouteCase
+ describe "render an action with a missing method and has special characters"
+
+ get "/render_implicit_action/simple/hyphen-ated"
+ assert_body "Hello hyphen-ated!"
+ assert_status 200
+ end
end \ No newline at end of file
diff --git a/actionpack/test/new_base/render_test.rb b/actionpack/test/new_base/render_test.rb
index 9ad79124b8..93bc8d854c 100644
--- a/actionpack/test/new_base/render_test.rb
+++ b/actionpack/test/new_base/render_test.rb
@@ -1,6 +1,24 @@
require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper")
module Render
+ class BlankRenderController < ActionController::Base2
+ self.view_paths = [ActionView::Template::FixturePath.new(
+ "render/blank_render/index.html.erb" => "Hello world!"
+ )]
+
+ def index
+ render
+ end
+ end
+
+ class TestBlankRender < SimpleRouteCase
+ describe "Render with blank"
+
+ get "/render/blank_render"
+ assert_body "Hello world!"
+ assert_status 200
+ end
+
class DoubleRenderController < ActionController::Base2
def index
render :text => "hello"
diff --git a/actionpack/test/new_base/test_helper.rb b/actionpack/test/new_base/test_helper.rb
index b40cbb163f..03af5a66a6 100644
--- a/actionpack/test/new_base/test_helper.rb
+++ b/actionpack/test/new_base/test_helper.rb
@@ -58,11 +58,31 @@ module ActionController
end
end
+ def render(action = action_name, options = {})
+ if action.is_a?(Hash)
+ options, action = action, nil
+ else
+ options.merge! :action => action
+ end
+
+ super(options)
+ end
+
def render_to_body(options = {})
options = {:template => options} if options.is_a?(String)
super
end
+ def process_action
+ ret = super
+ render if response_body.nil?
+ ret
+ end
+
+ def respond_to_action?(action_name)
+ super || view_paths.find_by_parts(action_name, {:formats => formats, :locales => [I18n.locale]}, controller_path)
+ end
+
# append_view_path File.join(File.dirname(__FILE__), '..', 'fixtures')
CORE_METHODS = self.public_instance_methods