Permalink
Browse files

Add documentation for CallbackMatcher in README

  • Loading branch information...
1 parent b508346 commit c0a5cf5022de9060f50d89f63017a51cd3366ea8 @dgalarza dgalarza committed Feb 18, 2014
Showing with 28 additions and 5 deletions.
  1. +28 −5 README.md
View
33 README.md
@@ -909,7 +909,7 @@ end
### ActionController Matchers
-*Jump to: [filter_param](#filter_param), [redirect_to](#redirect_to), [render_template](#render_template), [render_with_layout](#render_with_layout), [rescue_from](#rescue_from), [respond_with](#respond_with), [route](#route), [set_session](#set_session), [set_the_flash](#set_the_flash), [use_after_filter](#use_after_filter), [use_before_filter](#use_before_filter)*
+*Jump to: [filter_param](#filter_param), [redirect_to](#redirect_to), [render_template](#render_template), [render_with_layout](#render_with_layout), [rescue_from](#rescue_from), [respond_with](#respond_with), [route](#route), [set_session](#set_session), [set_the_flash](#set_the_flash), [use_after_filter / use_after_action](#use_after_filter--use_after_action), [use_around_filter / use_around_action](#use_around_filter--use_around_action), [use_before_filter / use_around_action](#use_before_filter--use_before_action)*
#### filter_param
@@ -1251,9 +1251,10 @@ class PostsControllerTest < ActionController::TestCase
end
```
-#### use_after_filter
+#### use_after_filter / use_after_action
-The `use_after_filter` ensures a given `after_filter` is used.
+The `use_after_filter` ensures a given `after_filter` is used. This is also
+available as `use_after_action` to provide Rails 4 support.
```ruby
class UserController < ActionController::Base
@@ -1271,9 +1272,31 @@ class UserControllerTest < ActionController::TestCase
end
```
-#### use_before_filter
+#### use_around_filter / use_around_action
-The `use_before_filter` ensures a given `before_filter` is used.
+The `use_around_filter` ensures a given `around_filter` is used. This is also
+available as `use_around_action` to provide Rails 4 support.
+
+```ruby
+class UserController < ActionController::Base
+ around_filter :log_activity
+end
+
+# RSpec
+describe UserController do
+ it { should use_around_filter(:log_activity) }
+end
+
+# Test::Unit
+class UserControllerTest < ActionController::TestCase
+ should use_around_filter(:log_activity)
+end
+```
+
+#### use_before_filter / use_before_action
+
+The `use_before_filter` ensures a given `before_filter` is used. This is also
+available as `use_before_action` for Rails 4 support.
```ruby
class UserController < ActionController::Base

0 comments on commit c0a5cf5

Please sign in to comment.