diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-20 14:13:34 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-20 14:13:34 +0000 |
commit | 2ee84cc6f92d49ec7004d0c99d66c6feb05cee9c (patch) | |
tree | 230aa20ddf77a6a9fe3efc5403d1796e60dcd9a2 /actionpack/test | |
parent | 91ff8352a4e5126b934d1b26988fa228fe13495f (diff) | |
download | rails-2ee84cc6f92d49ec7004d0c99d66c6feb05cee9c.tar.gz rails-2ee84cc6f92d49ec7004d0c99d66c6feb05cee9c.tar.bz2 rails-2ee84cc6f92d49ec7004d0c99d66c6feb05cee9c.zip |
Fixed that all redirect and render calls now return true, so you can use the pattern of "do and return". Added that renders and redirects called in before_filters will have the same effect as returning false: stopping the chain. Added that only one render or redirect can happen per action. The first call wins and subsequent calls are ignored.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@462 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/filters_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 58490aebba..2cc51f1e25 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -14,6 +14,20 @@ class FilterTest < Test::Unit::TestCase @ran_filter << "ensure_login" end end + + class RenderingController < ActionController::Base + before_filter :render_something_else + + def show + @ran_action = true + render_text "ran action" + end + + private + def render_something_else + render_text "something else" + end + end class ConditionalFilterController < ActionController::Base def show @@ -264,6 +278,12 @@ class FilterTest < Test::Unit::TestCase " after appended aroundfilter after aroundfilter after procfilter ", MixedFilterController.execution_log end + + def test_rendering_breaks_filtering_chain + response = test_process(RenderingController) + assert_equal "something else", response.body + assert !response.template.assigns["ran_action"] + end private def test_process(controller, action = "show") |