4 def initialize(expected)
10 # Satisfy expectation here. Return false or raise an error if it's not met.
12 if @expected =~ /^\/.*\/?$/ || @expected =~ /^".*"$/
13 regex_or_string = eval(@expected)
14 if Regexp === regex_or_string
15 (@actual =~ regex_or_string) ? true : false
17 @actual.index(regex_or_string) != nil
25 "expected #{@actual.inspect} to smart_match #{@expected.inspect}, but it didn't"
28 def negative_failure_message
29 "expected #{@actual.inspect} not to smart_match #{@expected.inspect}, but it did"
33 def smart_match(expected)
34 SmartMatch.new(expected)