                    (json/parse-string (:body @get-response)))))
   
     (context "when creating multiple circles"
-      (before (http-client/post "http://localhost:3000/circles" 
-                                      {:content-type :json
-                                       :body (json/generate-string 
-                                               {:name "Test Circle!"
-                                                :lead-link-name "Bill"
-                                                :lead-link-email "bfinn@example.com"})}))
+      (before (http-post-request "circles" 
+                                 (json/generate-string 
+                                   {:name "Test Circle!"
+                                    :lead-link-name "Bill"
+                                    :lead-link-email "bfinn@example.com"})
+                                 {:throw-exceptions true}))
 
-      (before (http-client/post "http://localhost:3000/circles" 
-                                      {:content-type :json
-                                       :body (json/generate-string 
-                                               {:name "Test Circle 2"
-                                                :lead-link-name "Bill"
-                                                :lead-link-email "bfinn@example.com"})}))
-      (with get-response (http-client/get "http://localhost:3000/circles" 
-                                          {:throw-exceptions false}))
+      (before (http-post-request "circles" 
+                                 (json/generate-string 
+                                   {:name "Test Circle 2"
+                                    :lead-link-name "Bill"
+                                    :lead-link-email "bfinn@example.com"})
+                                 {:throw-exceptions true}))
+
+      (with get-response (http-get-request "circles"))
 
       (it "should return an array of created circles"
         (should= 200 (:status @get-response))


  (context "roles"
    (context "when requesting the list of roles for a non-existent circle"
      (with roles-response (http-client/get (str "http://localhost:3000/circles/1234/roles")
                                            {:throw-exceptions false}))
        (it "should 404"
          (should= 404 (:status @roles-response))))

    (context "when posting a new role to a non-existent circle"
      (with roles-response (http-client/post 
                             (str "http://localhost:3000/circles/1234/roles")
                             {:throw-exceptions false
                              :content-type :json
                              :body (json/generate-string 
                                      {:name "My Role!"})}))
        (it "should 400 with a helpful error message"
            (should= 400 (:status @roles-response))
            (should-contain "Circle 1234 does not exist." (:body @roles-response))))

    (context "with a new circle"
      (with circle-location (get (json/parse-string 
                            (:body (http-client/post 
                                     "http://localhost:3000/circles" 
                                     {:throw-exceptions false
                                      :content-type :json
                                      :body (json/generate-string 
                                              {:name "Test Circle!"
                                               :lead-link-name "Bill"
                                               :lead-link-email "bfinn@example.com"})})))
                            "location"))

        (context "when requesting the list of roles"
          (with roles-response (http-client/get (str "http://localhost:3000" @circle-location "/roles")
                                                {:throw-exceptions false}))
          (it "should return an empty array"
              (should= 200 (:status @roles-response))
              (should= "[]" (:body @roles-response))))

        (context "creating a role"
          (with roles-response (http-client/post 
                                 (str "http://localhost:3000" @circle-location "/roles")
                                 {:throw-exceptions false
                                  :content-type :json
                                  :body (json/generate-string 
                                          {:name "My Role!"})}))
          (it "should redirect to the location of the newly created resource"
              (should= 303 (:status @roles-response))
              (should-contain "application/json" 

  (after (r/reset-database))

  (it "should return status code 404 at the root"
    (should= 404 (:status (http-get-request))))

  (context "circles"
    (context "when no circles have been created"
      (with response (http-get-request "circles"))
      (it "should return an empty array"
          (should= 200 (:status @response))
          (should= "[]" (:body @response))))
  
    (context "when creating a circle"
      (with response (http-post-request "circles" 
                                        (json/generate-string 
                                          {:name "Test Circle!"
                                           :lead-link-name "Bill"
                                           :lead-link-email "bfinn@example.com"})))
      (it "should redirect to the location of the newly created resource"
        (should= 303 (:status @response))
        (should-contain "application/json" (get-in @response [:headers "Content-Type"]))
