summaryrefslogtreecommitdiff
path: root/spec/mspec/lib/mspec/runner/filters/match.rb
blob: 539fd02d011f734a3a93141bfe936c2b54138c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class MatchFilter
  def initialize(what, *strings)
    @what = what
    @strings = strings
  end

  def ===(string)
    @strings.any? { |s| string.include?(s) }
  end

  def register
    MSpec.register @what, self
  end

  def unregister
    MSpec.unregister @what, self
  end
end