Sometimes you need to look at the filter chain in specs. You can do it like that on Rails 2:
controller.class.filter_chain.map(&:method)
Note that we need to look at the controller's class since before_filter
and after_filter
stuff happens on the class level.
Also mind that the above code will give you all filters, both those run before and after an action. You can query before?
and after?
on the filter objects to scope down to only some of them:
controller.class.filter_chain.select(&:before?).map(&:method)
For Rails 3, do it like this (warning, ugly!):
controller._process_action_callbacks.select { |c| c.kind == :before }.map(&:filter)
That all being said, it may make more sense for you to use a Cucumber feature in the first place.
Posted by Arne Hartherz to makandra dev (2012-08-28 11:32)