From f9d570bdd80010825c21eb32204471ba525915fa Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Wed, 9 Dec 2009 13:38:47 -0800 Subject: Simpler RenderOption API -- removes the need for registering the types and extending a module --- actionpack/test/controller/render_other_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'actionpack/test/controller') 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 -- cgit v1.2.3