 (defn tag-as-background-fake [fake]
   (concat fake `(:background :background :times (~'range 0))))
 
+
 ;;; Binding
 
+(defn #^:tested-private usable-default-function? [fake]
+  (and (bound? (:lhs fake))
+    (let [stashed-value (var-get (:lhs fake))
+          unfinished-fun (:midje/unfinished-fun (meta (:lhs fake)))]
+      (and (extended-fn? stashed-value)
+        (or (nil? unfinished-fun)
+          (not= unfinished-fun stashed-value))))))
 
 (letfn [(var-handled-by-fake? [function-var fake]
           (= function-var (:lhs fake)))]

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

(defmacro ^:private counting-nested-calls-calls [& forms]
  `(try
     (swap! *call-action-count* inc)
     ~@forms
     (finally (swap! *call-action-count* dec))))

(defn- call-faker
  "This is the function that handles all mocked calls." 
  [function-var actual-args fakes]
  (let [action (counting-nested-calls-calls (best-call-action function-var actual-args fakes))]
    (cond (nil? action)
      (clojure.test/report {:type :mock-argument-match-failure
                            :lhs function-var
                            :actual actual-args
                            :position (:position (first fakes))})

      (extended-fn? action)
      (apply action actual-args)

      :else (do
              (swap! (action :count-atom ) inc)
              ((action :result-supplier ))))))

;; Binding map related


                                                   with-altered-roots]]
        [midje.error-handling.exceptions :only [user-error]]
        [midje.internal-ideas.wrapping :only [with-wrapping-target]]
        [midje.ideas.arrow-symbols]
        [clojure.tools.macro :only [macrolet]])
  (:require [clojure.zip :as zip])
  (:import midje.ideas.metaconstants.Metaconstant))

