mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Tests that skips a controller filters that was set up using a class
This commit is contained in:
parent
c0fb8d0b9c
commit
f8d740af93
1 changed files with 16 additions and 0 deletions
|
@ -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"]
|
||||
|
|
Loading…
Reference in a new issue