class ActionFilter
ActionFilter is a base class for actions that are triggered by specs that match the filter. The filter may be specified by strings that match spec descriptions or by tags for strings that match spec descriptions.
Unlike TagFilter and RegexpFilter, ActionFilter instances do not affect the specs that are run. The filter is only used to trigger the action.
Public Class Methods
new(tags=nil, descs=nil)
click to toggle source
# File lib/mspec/runner/actions/filter.rb, line 13 def initialize(tags=nil, descs=nil) @tags = Array(tags) descs = Array(descs) @sfilter = MatchFilter.new(nil, *descs) unless descs.empty? end
Public Instance Methods
===(string)
click to toggle source
# File lib/mspec/runner/actions/filter.rb, line 19 def ===(string) @sfilter === string or @tfilter === string end
load()
click to toggle source
# File lib/mspec/runner/actions/filter.rb, line 23 def load @tfilter = nil return if @tags.empty? desc = MSpec.read_tags(@tags).map { |t| t.description } return if desc.empty? @tfilter = MatchFilter.new(nil, *desc) end
register()
click to toggle source
# File lib/mspec/runner/actions/filter.rb, line 33 def register MSpec.register :load, self end
unregister()
click to toggle source
# File lib/mspec/runner/actions/filter.rb, line 37 def unregister MSpec.unregister :load, self end