   {"how-to-post-comment" "How to post a comment"
    "how-to-remove-comment" "How to remove a comment"})
 
+(def old-or-new #{"old-path" "new-path"})
+
 (def posts [{:id 1 :content "Post #1"}
             {:id 2 :content "Post #2"}])
 
 (defn lookup-post [id]
   (some #(when (= (:id %) id) %) posts))
 
-(defroute responder
+(defroute handler
   (scheme :https
     (domain "api.example.org"
       (index (forbidden))

          (should= '("blog" "1234")
                   (split-path "/blog/1234")))))))




















    (with-fn-validation (it)))
  (it "index"
    (should= (ok "hello world")
             (handler (req "/" :get))))
  (context "path"
    (it "single segment"
      (should= (ok "Here's my blog.")
               (handler (req "/blog" :get))))
    (context "param"
      (it "int"
        (should= (ok "Post #1")
                 (handler (req "/blog/1" :get))))
      (context "nested path"
        (context "method: GET"
          (it "all segments consumed"
            (should= (ok "Get comments for post with id: 1")
                     (handler (req "/blog/1/comments" :get))))
          (it "truncate unconsumed segments"
            (should= (ok "Get comments for post with id: 1")
                     (handler (req "/blog/1/comments/35" :get)))))
        (context "method: POST"
          (it "all segments consumed"
            (should= (ok "Saved comment for post: 1")
                     (handler (req "/blog/1/comments" :post))))
          (it "unconsumed segments: not found"
            (should= (not-found)
                     (handler (req "/blog/1/comments/35" :post))))))
      (it "date"
        (should= (ok "Get blog post by date: #inst \"2013-01-01T00:00:00.000-00:00\"")
                 (handler (req "/blog/2013-01-01" :get))))
      (it "uuid"
        (should= (ok (str "Get blog post by uuid: " uuid))
                 (handler
                   (req (str "/blog/" uuid) :get))))
      (it "slug"
        (should= (ok "Get blog post by slug: clojure-101")
                 (handler (req "/blog/clojure-101" :get))))))
  (it "not found"
    (should= (not-found)
             (handler (req "/foo" :get))))
  (it "not-traversed"
    (should= (not-found)
             (handler (req "/admin/posts" :get))))
  (context "pred"
    (it "map"
      (should= (ok "FAQ: How to post a comment")
               (handler (req "/faq/how-to-post-comment" :get))))
    (it "set"
      (should= (ok "You chose: old-path")
               (handler (req "/old-path" :get)))))
  (context "guard"
    (it "default message"
      (should= (forbidden)
               (handler (req "/admin/super-secret" :get))))
    (it "custom message"
      (should= (text-response 403 "You shall not pass!")
               (handler (req "/admin/user" :get)))))
  (context "domain"
    (it "index"
      (should= (forbidden)
               (handler (api-req "/" :get))))
    (it "json"
      (should= (->json posts)
               (handler (api-req "/blog" :get)))))
  (context "method: ANY"
    (it "GET"
      (should= (ok "This is my blog.")
               (handler (req "/about" :get))))
    (it "POST"
      (should= (ok "This is my blog.")
               (handler (req "/about" :post))))
    (it "PUT"
      (should= (ok "This is my blog.")
               (handler (req "/about" :put))))
    (it "DELETE"
      (should= (ok "This is my blog.")
               (handler (req "/about" :delete))))
    (it "HEAD"
      (should= (ok "This is my blog.")
               (handler (req "/about" :head)))))
  (it "terminate"
    (should= (ok "You got sucked in.")
             (handler (req "/black-hole/billy" :get))))
  (it "custom parse/formatter"
    (should= (ok "Your zipcode is: 90210")
             (handler (req "/zipcode/90210" :get))))
  (it "nil response"
    (should= (text-response 204 "")
             (handler (req "/nil-resp" :get))))
  (context "routes"
    (it "frontend"
      (should= (ok "Here are some useful links.")
