Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9ecce5
commit 8c2ee97
Showing
2 changed files
with
5 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,15 +1,16 @@ | |||
(ns compojure.test.route | (ns compojure.test.route | ||
(:use clojure.test | (:use clojure.test | ||
ring.mock.request | |||
[clojure.contrib.io :only (slurp*)]) | [clojure.contrib.io :only (slurp*)]) | ||
(:require [compojure.route :as route])) | (:require [compojure.route :as route])) | ||
|
|
||
(deftest not-found-route | (deftest not-found-route | ||
(let [response ((route/not-found "foo") {})] | (let [response ((route/not-found "foo") (request :get "/"))] | ||
(is (= (:status response) 404)) | (is (= (:status response) 404)) | ||
(is (= (:body response) "foo")))) | (is (= (:body response) "foo")))) | ||
|
|
||
(deftest resources-route | (deftest resources-route | ||
(let [route (route/resources "/foo" {:root "/resources"}) | (let [route (route/resources "/foo" {:root "/resources"}) | ||
response (route {:request-method :get, :uri "/foo/test.txt"})] | response (route (request :get "/foo/test.txt"))] | ||
(is (= (:status response) 200)) | (is (= (:status response) 200)) | ||
(is (= (slurp* (:body response)) "foobar\n")))) | (is (= (slurp* (:body response)) "foobar\n")))) |