zdennis (owner)

Revisions

gist: 142075 Download_button fork
public
Public Clone URL: git://gist.github.com/142075.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  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