Permalink
Browse files

Tests that skips a controller filters that was set up using a class

  • Loading branch information...
1 parent c0fb8d0 commit f8d740af933e81648f69c65fb8229dd21beb4abb Ionatan Wiznia committed Feb 6, 2014
Showing with 16 additions and 0 deletions.
  1. +16 −0 actionpack/test/controller/filters_test.rb
@@ -225,6 +225,10 @@ class ConditionalOptionsSkipFilter < ConditionalFilterController
skip_before_filter :clean_up_tmp, if: -> { true }
end
+ class ClassController < ConditionalFilterController
+ before_filter ConditionalClassFilter
+ end
+
class PrependingController < TestController
prepend_before_filter :wonderful_life
# skip_before_filter :fire_flash
@@ -610,6 +614,18 @@ def test_running_conditional_skip_options
assert_equal %w( ensure_login ), assigns["ran_filter"]
end
+ def test_skipping_class_filters
+ test_process(ClassController)
+ assert_equal true, assigns["ran_class_filter"]
+
+ skipping_class_controller = Class.new(ClassController) do
+ skip_before_filter ConditionalClassFilter
+ end
+
+ test_process(skipping_class_controller)
+ assert_nil assigns['ran_class_filter']
+ end
+
def test_running_collection_condition_filters
test_process(ConditionalCollectionFilterController)
assert_equal %w( ensure_login ), assigns["ran_filter"]

0 comments on commit f8d740a

Please sign in to comment.