From 42d8548e94395435ccc00b453a4db65aca157726 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 6 Apr 2006 03:51:52 +0000 Subject: [PATCH] Failed test for Marcel to ponder git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4178 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/controller/filters_test.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 2459236002..d92143e41d 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -117,6 +117,8 @@ class FilterTest < Test::Unit::TestCase class ConditionalSkippingController < TestController skip_before_filter :ensure_login, :only => [ :login ] skip_after_filter :clean_up, :only => [ :login ] + + before_filter :find_user, :only => [ :change_password ] def login render :inline => "ran action" @@ -125,6 +127,12 @@ class FilterTest < Test::Unit::TestCase def change_password render :inline => "ran action" end + + protected + def find_user + @ran_filter ||= [] + @ran_filter << "find_user" + end end class ConditionalParentOfConditionalSkippingController < ConditionalFilterController @@ -382,7 +390,7 @@ class FilterTest < Test::Unit::TestCase def test_conditional_skipping_of_filters assert_nil test_process(ConditionalSkippingController, "login").template.assigns["ran_filter"] - assert_equal %w( ensure_login ), test_process(ConditionalSkippingController, "change_password").template.assigns["ran_filter"] + assert_equal %w( ensure_login find_user ), test_process(ConditionalSkippingController, "change_password").template.assigns["ran_filter"] assert_nil test_process(ConditionalSkippingController, "login").template.controller.instance_variable_get("@ran_after_filter") assert_equal %w( clean_up ), test_process(ConditionalSkippingController, "change_password").template.controller.instance_variable_get("@ran_after_filter") @@ -392,7 +400,7 @@ class FilterTest < Test::Unit::TestCase assert_equal %w( conditional_in_parent conditional_in_parent ), test_process(ChildOfConditionalParentController).template.assigns['ran_filter'] assert_nil test_process(ChildOfConditionalParentController, 'another_action').template.assigns['ran_filter'] end - + private def test_process(controller, action = "show") request = ActionController::TestRequest.new