aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2013-09-10 11:01:02 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2013-09-10 11:01:12 -0300
commita46fa8df063e6ac1aea2bfdfffbf69cd28fef858 (patch)
tree391c31350786fe108073b132639c1417b790b641 /actionpack
parenta1de8a8855abc01e1ae42551ee61c545ae169316 (diff)
downloadrails-a46fa8df063e6ac1aea2bfdfffbf69cd28fef858.tar.gz
rails-a46fa8df063e6ac1aea2bfdfffbf69cd28fef858.tar.bz2
rails-a46fa8df063e6ac1aea2bfdfffbf69cd28fef858.zip
Make AC standalone rendering work
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb7
-rw-r--r--actionpack/test/controller/new_base/render_text_test.rb15
2 files changed, 20 insertions, 2 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index adef2d5cf0..6f6079d3c5 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -47,7 +47,6 @@ module AbstractController
# Performs the actual template rendering.
# :api: public
def render_to_body(options = {})
- raise NotImplementedError, "no render operation defined"
end
# Return Content-Type of rendered content
@@ -77,7 +76,11 @@ module AbstractController
# render "foo/bar" to render :file => "foo/bar".
# :api: plugin
def _normalize_args(action=nil, options={})
- options
+ if action.is_a? Hash
+ action
+ else
+ options
+ end
end
# Normalize options.
diff --git a/actionpack/test/controller/new_base/render_text_test.rb b/actionpack/test/controller/new_base/render_text_test.rb
index d6c3926a4d..2a253799f3 100644
--- a/actionpack/test/controller/new_base/render_text_test.rb
+++ b/actionpack/test/controller/new_base/render_text_test.rb
@@ -1,6 +1,15 @@
require 'abstract_unit'
module RenderText
+ class MinimalController < ActionController::Metal
+ include AbstractController::Rendering
+ include ActionController::Rendering
+
+ def index
+ render text: "Hello World!"
+ end
+ end
+
class SimpleController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new]
@@ -63,6 +72,12 @@ module RenderText
end
class RenderTextTest < Rack::TestCase
+ test "rendering text from a minimal controller" do
+ get "/render_text/minimal/index"
+ assert_body "Hello World!"
+ assert_status 200
+ end
+
test "rendering text from an action with default options renders the text with the layout" do
with_routing do |set|
set.draw { get ':controller', :action => 'index' }