aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/render_test.rb
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-10-25 06:38:01 +0000
committerMichael Koziarski <michael@koziarski.com>2007-10-25 06:38:01 +0000
commit12d8d48b7132e0467b477e6a88931840188f6c61 (patch)
treeafa662a88e6428837d8dc9ef8746f0594ebf1abc /actionpack/test/controller/render_test.rb
parent7c3581cba243aa17a9f002b40c5f017d8e968492 (diff)
downloadrails-12d8d48b7132e0467b477e6a88931840188f6c61.tar.gz
rails-12d8d48b7132e0467b477e6a88931840188f6c61.tar.bz2
rails-12d8d48b7132e0467b477e6a88931840188f6c61.zip
Refactor the default rendering out to a method called default_render to provide a hook for plugin authors. Closes #9953 [cjheath]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8011 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/render_test.rb')
-rw-r--r--actionpack/test/controller/render_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb
index 22f7fcb790..7765c62a5e 100644
--- a/actionpack/test/controller/render_test.rb
+++ b/actionpack/test/controller/render_test.rb
@@ -152,6 +152,23 @@ class TestController < ActionController::Base
end
end
+ def default_render
+ if @alternate_default_render
+ @alternate_default_render.call
+ else
+ render
+ end
+ end
+
+ def render_alternate_default
+ # For this test, the method "default_render" is overridden:
+ @alternate_default_render = lambda {
+ render :update do |page|
+ page.replace :foo, :partial => 'partial'
+ end
+ }
+ end
+
def rescue_action(e) raise end
private
@@ -413,6 +430,11 @@ class RenderTest < Test::Unit::TestCase
assert_equal 'partial js', @response.body
end
+ def test_should_render_with_alternate_default_render
+ xhr :get, :render_alternate_default
+ assert_equal %(Element.replace("foo", "partial html");), @response.body
+ end
+
protected
def etag_for(text)