Skip to content

Commit

Permalink
Add documentation for CallbackMatcher in README
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Galarza committed Mar 7, 2014
1 parent b508346 commit c0a5cf5
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions README.md
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c0a5cf5

Please sign in to comment.