avatar

39

Add a few of my matchers for safekeeping by chrisk, 04 Feb, 2008 03:54 AM
Diff this changeset:
include_text_matcher.rb
      class IncludeText
  def initialize(expected)
    @expected = expected
  end

  def matches?(actual)
    @actual = actual.body
    @actual.downcase.include?(@expected.downcase)
  end

  def failure_message
    "expected #{@actual.inspect} to include #{@expected.inspect}, but it didn't"
  end

  def negative_failure_message
    "expected #{@actual.inspect} not to include #{@expected.inspect}, but it did"
  end
end

def include_text(expected)
  IncludeText.new(expected)
end