From eaae0399ad205c8d5afa3130b07f4c31e0c04aac Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 9 Oct 2006 06:11:40 +0000 Subject: r5540@ks: jeremy | 2006-10-08 23:05:30 -0700 #5949 r5541@ks: jeremy | 2006-10-08 23:07:08 -0700 Fix filter skipping in controller subclasses. r5557@ks: jeremy | 2006-10-08 23:11:24 -0700 Update changelog. Closes #5949, references #6297, references #6299. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5268 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/filters_test.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'actionpack/test/controller') diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 421758ac34..a098840486 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -154,7 +154,7 @@ class FilterTest < Test::Unit::TestCase @ran_filter << "find_user" end end - + class ConditionalParentOfConditionalSkippingController < ConditionalFilterController before_filter :conditional_in_parent, :only => [:show, :another_action] after_filter :conditional_in_parent, :only => [:show, :another_action] @@ -172,6 +172,10 @@ class FilterTest < Test::Unit::TestCase skip_after_filter :conditional_in_parent, :only => :another_action end + class AnotherChildOfConditionalParentController < ConditionalParentOfConditionalSkippingController + skip_before_filter :conditional_in_parent, :only => :show + end + class ProcController < PrependingController before_filter(proc { |c| c.assigns["ran_proc_filter"] = true }) end @@ -413,6 +417,12 @@ class FilterTest < Test::Unit::TestCase assert_nil test_process(ChildOfConditionalParentController, 'another_action').template.assigns['ran_filter'] end + def test_condition_skipping_of_filters_when_siblings_also_have_conditions + assert_equal %w( conditional_in_parent conditional_in_parent ), test_process(ChildOfConditionalParentController).template.assigns['ran_filter'], "1" + assert_equal nil, test_process(AnotherChildOfConditionalParentController).template.assigns['ran_filter'] + assert_equal %w( conditional_in_parent conditional_in_parent ), test_process(ChildOfConditionalParentController).template.assigns['ran_filter'] + end + private def test_process(controller, action = "show") request = ActionController::TestRequest.new -- cgit v1.2.3