aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/filters_test.rb
diff options
context:
space:
mode:
authorIain Beeston <iain.beeston@gmail.com>2015-02-23 20:33:04 +0000
committerIain Beeston <iain.beeston@gmail.com>2015-02-24 08:17:24 +0000
commit3fbc6328439abf14f009ae4b6fbd6ea7157d4fda (patch)
tree28f916c15081e3e70a0f4438b7d51688b59f8e16 /actionpack/test/controller/filters_test.rb
parent43fb8182663be99418b346f5aa43b0fa1ac95ce4 (diff)
downloadrails-3fbc6328439abf14f009ae4b6fbd6ea7157d4fda.tar.gz
rails-3fbc6328439abf14f009ae4b6fbd6ea7157d4fda.tar.bz2
rails-3fbc6328439abf14f009ae4b6fbd6ea7157d4fda.zip
Deprecate `AbstractController::Callbacks#skip_action_callback`
As part of #19029, in future `skip_before_action`, `skip_after_action` and `skip_around_action` will raise an ArgumentError if the specified callback does not exist. `skip_action_callback` calls all three of these methods and will almost certainly result in an ArgumentError. If anyone wants to remove all three callbacks then they can still call the three individual methods. Therefore let's deprecate `skip_action_callback` now and remove it when #19029 is merged.
Diffstat (limited to 'actionpack/test/controller/filters_test.rb')
-rw-r--r--actionpack/test/controller/filters_test.rb24
1 files changed, 22 insertions, 2 deletions
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb
index b9fb6be4e3..94faaeec69 100644
--- a/actionpack/test/controller/filters_test.rb
+++ b/actionpack/test/controller/filters_test.rb
@@ -967,8 +967,15 @@ class ControllerWithAllTypesOfFilters < PostsController
end
class ControllerWithTwoLessFilters < ControllerWithAllTypesOfFilters
- skip_action_callback :around_again
- skip_action_callback :after
+ skip_around_action :around_again
+ skip_after_action :after
+end
+
+class SkipFilterUsingSkipActionCallback < ControllerWithAllTypesOfFilters
+ ActiveSupport::Deprecation.silence do
+ skip_action_callback :around_again
+ skip_action_callback :after
+ end
end
class YieldingAroundFiltersTest < ActionController::TestCase
@@ -1055,6 +1062,19 @@ class YieldingAroundFiltersTest < ActionController::TestCase
assert_equal 3, controller.instance_variable_get(:@try)
end
+ def test_skipping_with_skip_action_callback
+ test_process(SkipFilterUsingSkipActionCallback,'no_raise')
+ assert_equal 'before around (before yield) around (after yield)', assigns['ran_filter'].join(' ')
+ end
+
+ def test_deprecated_skip_action_callback
+ assert_deprecated do
+ Class.new(TestController) do
+ skip_action_callback :clean_up
+ end
+ end
+ end
+
protected
def test_process(controller, action = "show")
@controller = controller.is_a?(Class) ? controller.new : controller