diff options
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/filters_test.rb | 12 |
1 files changed, 11 insertions, 1 deletions
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 |