Permalink
Browse files

Add more ring.util.response tests.

  • Loading branch information...
1 parent 0949082 commit 0591dc44ae0d01a49298f049dbb6a0c26bb78059 @mmcgrana committed Mar 3, 2010
Showing with 12 additions and 2 deletions.
  1. +2 −2 ring-core/src/ring/util/response.clj
  2. +10 −0 ring-core/test/ring/util/response_test.clj
View
4 ring-core/src/ring/util/response.clj
@@ -14,8 +14,8 @@
headers."
[body]
{:status 200
- :body body
- :headers {}})
+ :headers {}
+ :body body})
(defn- safe-path?
"Is a filepath safe for a particular root?"
View
10 ring-core/test/ring/util/response_test.clj
@@ -6,3 +6,13 @@
(is (= {:status 302 :headers {"Location" "http://google.com"} :body ""}
(redirect "http://google.com"))))
+(deftest test-response
+ (is (= {:status 200 :headers {} :body "foobar"}
+ (response "foobar"))))
+
+(deftest test-status
+ (is (= {:status 200 :body ""} (status {:status nil :body ""} 200))))
+
+(deftest test-content-type
+ (is (= {:status 200 :headers {"Content-Type" "text/html" "Content-Length" "10"}}
+ (content-type {:status 200 :headers {"Content-Length" "10"}} "text/html"))))

0 comments on commit 0591dc4

Please sign in to comment.