1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00

Add documentation for CallbackMatcher in README

This commit is contained in:
Damian Galarza 2014-02-17 20:38:28 -05:00
parent b5083467bc
commit c0a5cf5022

View file

@ -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