lib/caricature/expectation.rb in caricature-0.7.5 vs lib/caricature/expectation.rb in caricature-0.7.6

- old
+ new

@@ -22,10 +22,10 @@ # When you specify arguments other than +:any+ it will try to match the specified arguments in addition # to the method name. It will then also return the first result it can find. def find(method_name, mode=:instance, *args) expectations = mode == :class ? @class_expectations : @instance_expectations - candidates = expectations.select { |exp| exp.method_name.to_s.to_sym == method_name.to_s.to_sym } + candidates = expectations.select { |exp| exp.method_name.to_s.underscore =~ /#{method_name}|#{method_name.to_s.underscore}/ } with_arguments_candidates = candidates.select { |exp| exp.args == args } with_arguments_candidates.first || candidates.select { |exp| exp.any_args? }.first end \ No newline at end of file