     (= (count actual-args) (count (fake :arg-matchers )))
     (extended-list-= actual-args (fake :arg-matchers ))))
 
-(defn- fakes-for-call [fakes function-var actual-args]
-  (filter (partial call-handled-by-fake? function-var actual-args) fakes))
-
 (defn usable-default-function? [fake]
   (if (not (bound? (:lhs fake)))
     false

             "  (def all-even? (partial every? even?))"
             "  ;; ..."
             "  (provided (all-even? ..xs..) => true)")))
  (let [possible-fakes (fakes-for-var fakes function-var)
        found (first (fakes-for-call possible-fakes function-var actual-args))]
    (cond found
      found

      (empty? possible-fakes)
      nil

      ;; For finding a default, any possible fake is as good as any other
      (not (usable-default-function? (first possible-fakes)))
      nil

      :else (:value-at-time-of-faking (first possible-fakes)))))

(defn call-faker [function-var actual-args fakes]
  "This is the function that handles all mocked calls."

;; -*- indent-tabs-mode: nil -*-

(ns midje.internal-ideas.fakes
  (:use [utilize.seq :only (separate find-first)]
        [midje.util.object-utils :only [object-name]]
        [clojure.test :only [report]]
        [midje.checkers :only [exactly]]
