Add a few of my matchers for safekeeping
- ~
- rspec_matchers
- include_text_matcher.rb
| 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
