Skip to content

Instantly share code, notes, and snippets.

@ileitch
Created November 4, 2011 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ileitch/1340123 to your computer and use it in GitHub Desktop.
Save ileitch/1340123 to your computer and use it in GitHub Desktop.
RSpec matcher for Rails 3 controller filters.
RSpec::Matchers.define :have_before_filter do |filter|
match do |actual|
actual._process_action_callbacks.select { |c| c.kind == :before }.map(&:filter).include?(filter)
end
end
MyController.should have_before_filter(:filter_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment