1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #13962 from iwiznia/test_controller_skip_action_class

Test for skipping a controller filter set up with a class Part 3
This commit is contained in:
Yves Senn 2014-02-07 08:35:18 +01:00
commit e3d8194582

View file

@ -225,6 +225,10 @@ class FilterTest < ActionController::TestCase
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 @@ class FilterTest < ActionController::TestCase
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"]