Tests that skips a controller filters that was set up using a class
This commit is contained in:
parent
c0fb8d0b9c
commit
f8d740af93
|
@ -225,6 +225,10 @@ class FilterTest < ActionController::TestCase
|
||||||
skip_before_filter :clean_up_tmp, if: -> { true }
|
skip_before_filter :clean_up_tmp, if: -> { true }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class ClassController < ConditionalFilterController
|
||||||
|
before_filter ConditionalClassFilter
|
||||||
|
end
|
||||||
|
|
||||||
class PrependingController < TestController
|
class PrependingController < TestController
|
||||||
prepend_before_filter :wonderful_life
|
prepend_before_filter :wonderful_life
|
||||||
# skip_before_filter :fire_flash
|
# skip_before_filter :fire_flash
|
||||||
|
@ -610,6 +614,18 @@ class FilterTest < ActionController::TestCase
|
||||||
assert_equal %w( ensure_login ), assigns["ran_filter"]
|
assert_equal %w( ensure_login ), assigns["ran_filter"]
|
||||||
end
|
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
|
def test_running_collection_condition_filters
|
||||||
test_process(ConditionalCollectionFilterController)
|
test_process(ConditionalCollectionFilterController)
|
||||||
assert_equal %w( ensure_login ), assigns["ran_filter"]
|
assert_equal %w( ensure_login ), assigns["ran_filter"]
|
||||||
|
|
Loading…
Reference in New Issue