 
     (it "should produce a handler returning valid response maps"
 
-      (let [handler (dispatcher/compile-dispatch-table simple-dispatch-table)
-            index-response (handler (mock/request :get "/foo"))
-            show-response  (handler (mock/request :get "/foo/1"))]
+      (let [handler (dispatcher/compile-dispatch-table
+                      (mapv (comp #(conj % rook/wrap-with-default-arg-resolvers) pop)
+                        simple-dispatch-table))
+            index-response  (handler (mock/request :get "/foo"))
+            show-response   (handler (mock/request :get "/foo/1"))
+            create-response (handler (merge (mock/request :post "/foo")
+                                       {:params {:x 123}}))]
         (should= {:status 200 :headers {} :body "Hello!"}
           index-response)
         (should= {:status 200 :headers {} :body "Interesting id: 1"}
-          show-response)))
+          show-response)
+        (should= {:status 200 :headers {} :body "Created 123"}
+          create-response)))
 
     (it "should inject the middleware"
 


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

(ns rook.dispatcher-spec
  (:use speclj.core)
  (:require [io.aviso.rook.dispatcher :as dispatcher]
            [io.aviso.rook.client :as client]
            [io.aviso.rook.utils :as utils]
            [io.aviso.rook.async :as rook-async]
            [io.aviso.rook :as rook]
            [ring.mock.request :as mock]
            [clojure.core.async :as async]))


(defn namespace-handler
  "Produces a handler based on the given namespace."
  ([ns-sym]
     (dispatcher/compile-dispatch-table
       (dispatcher/namespace-dispatch-table ns-sym)))
  ([context-pathvec ns-sym]
     (dispatcher/compile-dispatch-table
       (dispatcher/namespace-dispatch-table context-pathvec ns-sym)))
  ([context-pathvec ns-sym middleware]
     (dispatcher/compile-dispatch-table
       (dispatcher/namespace-dispatch-table context-pathvec ns-sym middleware)))
  ([options context-pathvec ns-sym middleware]
     (dispatcher/compile-dispatch-table options
       (dispatcher/namespace-dispatch-table context-pathvec ns-sym middleware))))


(create-ns 'example.foo)

