diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-23 23:53:55 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-23 23:53:55 +0000 |
commit | 11a2bb91f5153ab408ba7bd7a58948334729997b (patch) | |
tree | 5c1e15a48209488bfcfddca2c98796a76b709470 | |
parent | 9a929b67ebff58f096e16ad7f0e31ffd6f48a8ff (diff) | |
download | rails-11a2bb91f5153ab408ba7bd7a58948334729997b.tar.gz rails-11a2bb91f5153ab408ba7bd7a58948334729997b.tar.bz2 rails-11a2bb91f5153ab408ba7bd7a58948334729997b.zip |
Added some unit tests #706
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@775 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/test/controller/filters_test.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 2cc51f1e25..af14385fe3 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -179,6 +179,30 @@ class FilterTest < Test::Unit::TestCase append_around_filter AppendedAroundFilter.new end + class MixedSpecializationController < ActionController::Base + class OutOfOrder < StandardError; end + + before_filter :first + before_filter :second, :only => :foo + + def foo + render_text 'foo' + end + + def bar + render_text 'bar' + end + + protected + def first + @first = true + end + + def second + raise OutOfOrder unless @first + end + end + def test_added_filter_to_inheritance_graph assert_equal [ :fire_flash, :ensure_login ], TestController.before_filters @@ -285,6 +309,18 @@ class FilterTest < Test::Unit::TestCase assert !response.template.assigns["ran_action"] end + def test_filters_with_mixed_specialization_run_in_order + assert_nothing_raised do + response = test_process(MixedSpecializationController, 'bar') + assert_equal 'bar', response.body + end + + assert_nothing_raised do + response = test_process(MixedSpecializationController, 'foo') + assert_equal 'foo', response.body + end + end + private def test_process(controller, action = "show") request = ActionController::TestRequest.new |