Created
November 4, 2011 18:41
-
-
Save ileitch/1340123 to your computer and use it in GitHub Desktop.
RSpec matcher for Rails 3 controller filters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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