aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2009-12-09 13:38:47 -0800
committerCarlhuda <carlhuda@engineyard.com>2009-12-09 13:40:49 -0800
commitf9d570bdd80010825c21eb32204471ba525915fa (patch)
tree8e662ebe59db9f886d18f9acb2856c9b688dbd19 /actionpack/test/controller
parent9fbde11b8b2a43206bcd1a135e763751cae98264 (diff)
downloadrails-f9d570bdd80010825c21eb32204471ba525915fa.tar.gz
rails-f9d570bdd80010825c21eb32204471ba525915fa.tar.bz2
rails-f9d570bdd80010825c21eb32204471ba525915fa.zip
Simpler RenderOption API -- removes the need for registering the types and extending a module
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/render_other_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_other_test.rb b/actionpack/test/controller/render_other_test.rb
index 51c3c55545..dfc4f2db8c 100644
--- a/actionpack/test/controller/render_other_test.rb
+++ b/actionpack/test/controller/render_other_test.rb
@@ -2,6 +2,11 @@ require 'abstract_unit'
require 'controller/fake_models'
require 'pathname'
+ActionController.add_renderer :simon do |says, options|
+ self.content_type = Mime::TEXT
+ self.response_body = "Simon says: #{says}"
+end
+
class RenderOtherTest < ActionController::TestCase
class TestController < ActionController::Base
protect_from_forgery
@@ -109,6 +114,10 @@ class RenderOtherTest < ActionController::TestCase
end
end
+ def render_simon_says
+ render :simon => "foo"
+ end
+
private
def default_render
if @alternate_default_render
@@ -240,4 +249,9 @@ class RenderOtherTest < ActionController::TestCase
xhr :get, :render_alternate_default
assert_equal %(Element.replace("foo", "partial html");), @response.body
end
+
+ def test_using_custom_render_option
+ get :render_simon_says
+ assert_equal "Simon says: foo", @response.body
+ end
end