Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #10591 from acapilleri/cond_callback_test

add test for skip_before_filter with condition
  • Loading branch information...
commit 9db6e63bfbb1756a6f43620dfa7e099d89c46dd0 2 parents dcc1267 + 8da819e
Aaron Patterson tenderlove authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 actionpack/test/controller/filters_test.rb
13 actionpack/test/controller/filters_test.rb
View
@@ -213,6 +213,14 @@ class ConditionalOptionsFilter < ConditionalFilterController
before_filter :clean_up_tmp, :if => Proc.new { |c| false }
end
+ class ConditionalOptionsSkipFilter < ConditionalFilterController
+ before_filter :ensure_login
+ before_filter :clean_up_tmp
+
+ skip_before_filter :ensure_login, if: -> { false }
+ skip_before_filter :clean_up_tmp, if: -> { true }
+ end
+
class PrependingController < TestController
prepend_before_filter :wonderful_life
# skip_before_filter :fire_flash
@@ -593,6 +601,11 @@ def test_running_conditional_options
assert_equal %w( ensure_login ), assigns["ran_filter"]
end
+ def test_running_conditional_skip_options
+ test_process(ConditionalOptionsSkipFilter)
+ assert_equal %w( ensure_login ), assigns["ran_filter"]
+ end
+
def test_running_collection_condition_filters
test_process(ConditionalCollectionFilterController)
assert_equal %w( ensure_login ), assigns["ran_filter"]
Please sign in to comment.
Something went wrong with that request. Please try again.