 
     (it "should inject the middleware"
 
-      (let [handler (dispatcher/compile-dispatch-table simple-dispatch-table)
-            a (atom 0)]
-        (binding [*default-middleware* (fn [handler]
-                                         (fn [request]
-                                           (swap! a inc)
-                                           (handler request)))]
-          (handler (mock/request :get "/foo"))
-          (should= 1 @a)))))
+      (let [a (atom 0)]
+        (with-redefs [default-middleware (fn [handler]
+                                           (fn [request]
+                                             (swap! a inc)
+                                             (handler request)))]
+          (let [handler (dispatcher/compile-dispatch-table simple-dispatch-table)]
+            (handler (mock/request :get "/foo"))
+            (should= 1 @a))))))
 
   (describe "namespace-dispatch-table"
 

        (:request-method request)))))


(create-ns 'example.foo)

(binding [*ns* (the-ns 'example.foo)]


      (let [dt (set (dispatcher/unnest-dispatch-table
                      (dispatcher/namespace-dispatch-table
                        ["foo"] 'example.foo `default-middleware)))]
        (should= (set simple-dispatch-table) dt))))

  (describe "compiled handlers"
