Created
July 7, 2009 13:23
-
-
Save zdennis/142075 to your computer and use it in GitHub Desktop.
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
def stub_filters_of_type(type, options) | |
controller.class.send("#{type}_filters").each do |filter_name| | |
next if options[:except].respond_to?(:include?) && options[:except].include?(filter_name) | |
next if options[:except] == filter_name | |
next if filter_name.is_a?(Proc) | |
controller.stub!(filter_name).and_return(true) | |
end | |
end | |
def stub_before_filters!(options = {}) | |
stub_filters_of_type(:before, options) | |
end | |
def stub_after_filters!(options = {}) | |
stub_filters_of_type(:after, options) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment