Permalink
Browse files

Add root view to avoid 500 error when doing requests to '/'

  • Loading branch information...
1 parent d27d942 commit 273de34989844ae28d0c1ad33df3ede9d701a62a @rafael rafael committed Mar 7, 2012
Showing with 20 additions and 0 deletions.
  1. +7 −0 src/thoth/views/root.clj
  2. +13 −0 test/thoth/test/views/root.clj
View
@@ -0,0 +1,7 @@
+(ns thoth.views.root
+ (:require [thoth.models.shortener :as shortener])
+ (:require [noir.response :as response])
+ (:use noir.core))
+
+(defpage "/" []
+ (response/status 404 "The url provided coudln't be found"))
@@ -0,0 +1,13 @@
+(ns thoth.test.views.get
+ (:use [thoth.config :only (check-for-test-env!)])
+ (:use thoth.views.root)
+ (:use noir.util.test)
+ (:use [clojure.test]))
+
+(check-for-test-env!)
+
+(deftest get-root-url-should-be-404
+ (-> (send-request "/")
+ (has-status 404)
+ (has-body "The url provided coudln't be found")))
+

0 comments on commit 273de34

Please sign in to comment.