this is what the matcher is called on. In this case:
foo.should contains(:bars)
foo would be passed to the initialize
# File lib/rwebspec-common/matchers/contains_text.rb, line 7 def initialize(expected) @expected = expected end
# File lib/rwebspec-common/matchers/contains_text.rb, line 16 def actual_text @actual.to_s.length > 256 ? @actual[0, 255] : @actual end
error message for should
# File lib/rwebspec-common/matchers/contains_text.rb, line 21 def failure_message "expected '#{actual_text}' to contain '#{@expected}', but it didn't" end
# File lib/rwebspec-common/matchers/contains_text.rb, line 11 def matches?(actual) @actual = actual return actual && actual.include?(@expected) end
error message for should_not
# File lib/rwebspec-common/matchers/contains_text.rb, line 26 def negative_failure_message "expected '#{actual_text}' not to contain '#{@expected}', but it did" end