Skip to content

Instantly share code, notes, and snippets.

@canweriotnow
Created January 8, 2014 18:54
Show Gist options
  • Save canweriotnow/8322235 to your computer and use it in GitHub Desktop.
Save canweriotnow/8322235 to your computer and use it in GitHub Desktop.
speclj crash with luminus
(ns hedgehog.handler
(:require [compojure.core :refer [defroutes]]
[hedgehog.routes.home :refer [home-routes]]
[noir.util.middleware :as middleware]
[compojure.route :as route]
[taoensso.timbre :as timbre]
[com.postspectacular.rotor :as rotor]
[selmer.parser :as parser]
[environ.core :refer [env]]
[hedgehog.routes.cljsexample :refer [cljs-routes]]))
(defroutes
app-routes
(route/resources "/")
(route/not-found "Not Found"))
(defn init
"init will be called once when
app is deployed as a servlet on
an app server such as Tomcat
put any initialization code here"
[]
(timbre/set-config!
[:appenders :rotor]
{:min-level :info,
:enabled? true,
:async? false,
:max-message-per-msecs nil,
:fn rotor/append})
(timbre/set-config!
[:shared-appender-config :rotor]
{:path "hedgehog.log", :max-size (* 512 1024), :backlog 10})
(if (env :selmer-dev) (parser/cache-off!))
(timbre/info "hedgehog started successfully"))
(defn destroy
"destroy will be called when your application
shuts down, put any clean up code here"
[]
(timbre/info "hedgehog is shutting down..."))
(defn template-error-page [handler]
(if (env :selmer-dev)
(fn [request]
(try
(handler request)
(catch
clojure.lang.ExceptionInfo
ex
(let [{:keys [type error-template], :as data} (ex-data ex)]
(if (= :selmer-validation-error type)
{:status 500, :body (parser/render error-template data)}
(throw ex))))))
handler))
(def app
(middleware/app-handler
[cljs-routes home-routes app-routes]
:middleware
[template-error-page]
:access-rules
[]
:formats
[:json-kw :edn]))
(ns hedgehog.handler-spec
(:require [speclj.core :refer :all]
[ring.mock.request :refer :all]
[hedgehog.handler :refer :all]))
(describe "main-route"
(it "should return a 200 status"
(let [response (app (request :get "/"))]
(should= (:status response) 200))))
(run-specs)
(defproject
hedgehog
"0.1.0-SNAPSHOT"
:repl-options
{:init-ns hedgehog.repl}
:dependencies
[[org.clojure/core.cache "0.6.3"]
[org.clojure/core.memoize "0.5.6" :exclusions [org.clojure/core.cache]]
[ring-server "0.3.1"]
[domina "1.0.2"]
[org.clojure/clojurescript "0.0-2030"]
[environ "0.4.0"]
[com.taoensso/timbre "2.7.1"]
[prismatic/dommy "0.1.2"]
[markdown-clj "0.9.38"]
[http-kit "2.1.13"]
[com.taoensso/tower "2.0.1"]
[org.clojure/clojure "1.5.1"]
[cljs-ajax "0.2.2"]
[selmer "0.5.5"]
[compojure "1.1.6"]
[lib-noir "0.7.9"]
[com.postspectacular/rotor "0.1.0"]
[com.novemberain/monger "1.7.0-beta1"]
[com.cemerick/friend "0.2.0"]
[friend-oauth2 "0.1.1"]]
:cljsbuild
{:builds
[{:source-paths ["src-cljs"],
:compiler
{:pretty-print false,
:output-to "resources/public/js/site.js",
:optimizations :advanced}}]}
:ring
{:handler hedgehog.handler/app,
:init hedgehog.handler/init,
:destroy hedgehog.handler/destroy}
:profiles
{:production
{:ring
{:open-browser? false, :stacktraces? false, :auto-reload? false}},
:dev
{:dependencies [[ring-mock "0.1.5"] [ring/ring-devel "1.2.1"] [speclj "2.9.1"]],
:env {:selmer-dev true}}}
:test-paths ["spec"]
:url
"https://github.com/AnEstuary/hedgehog"
:aot
:all
:main
hedgehog.core
:plugins
[[lein-ring "0.8.8"] [lein-environ "0.4.0"] [lein-cljsbuild "0.3.3"] [speclj "2.9.1"]]
:description
"FIXME: write description"
:min-lein-version "2.0.0")
Errors:
1) java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
... 18 stack levels elided ...
at ring.middleware.format$loading__4910__auto__.invoke(format.clj:1)
at ring.middleware.format__init.load(Unknown Source)
at ring.middleware.format__init.<clinit>(Unknown Source)
... 18 stack levels elided ...
at noir.util.middleware$loading__4910__auto__.invoke(middleware.clj:1)
at noir.util.middleware__init.load(Unknown Source)
at noir.util.middleware__init.<clinit>(Unknown Source)
... 18 stack levels elided ...
at hedgehog.handler$loading__4910__auto__.invoke(handler.clj:1)
at hedgehog.handler__init.load(Unknown Source)
at hedgehog.handler__init.<clinit>(Unknown Source)
... 18 stack levels elided ...
at hedgehog.handler_spec$eval1433$loading__4910__auto____1434.invoke(/Users/jason/estuary/hedgehog/spec/hedgehog/handler_spec.clj:1)
at hedgehog.handler_spec$eval1433.invoke(/Users/jason/estuary/hedgehog/spec/hedgehog/handler_spec.clj:1)
... 17 stack levels elided ...
at user$eval1262.invoke(NO_SOURCE_FILE)
... 4 stack levels elided ...
at leiningen.core.eval$fn__3507.invoke(eval.clj:304)
... 1 stack levels elided ...
at leiningen.core.eval$eval_in_project.invoke(eval.clj:326)
at leiningen.spec$spec.doInvoke(spec.clj:36)
... 5 stack levels elided ...
at leiningen.core.main$resolve_task$fn__2962.doInvoke(main.clj:151)
... 6 stack levels elided ...
at leiningen.core.main$apply_task.invoke(main.clj:192)
at lein_environ.plugin$write_env_to_file.invoke(plugin.clj:11)
... 4 stack levels elided ...
at robert.hooke$compose_hooks$fn__8566.doInvoke(hooke.clj:40)
... 2 stack levels elided ...
at robert.hooke$run_hooks.invoke(hooke.clj:46)
at robert.hooke$prepare_for_hooks$fn__8571$fn__8572.doInvoke(hooke.clj:54)
... 3 stack levels elided ...
at leiningen.core.main$resolve_and_apply.invoke(main.clj:196)
at leiningen.core.main$_main$fn__3025.invoke(main.clj:265)
at leiningen.core.main$_main.doInvoke(main.clj:252)
... 12 stack levels elided ...
Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core.cache/through
... 9 stack levels elided ...
at ring.middleware.format_response$make_encoder.invoke(format_response.clj:94)
at ring.middleware.format_response__init.load(Unknown Source)
at ring.middleware.format_response__init.<clinit>(Unknown Source)
... 18 stack levels elided ...
at ring.middleware.format$loading__4910__auto__.invoke(format.clj:1)
at ring.middleware.format__init.load(Unknown Source)
at ring.middleware.format__init.<clinit>(Unknown Source)
... 18 stack levels elided ...
at noir.util.middleware$loading__4910__auto__.invoke(middleware.clj:1)
at noir.util.middleware__init.load(Unknown Source)
at noir.util.middleware__init.<clinit>(Unknown Source)
... 18 stack levels elided ...
at hedgehog.handler$loading__4910__auto__.invoke(handler.clj:1)
at hedgehog.handler__init.load(Unknown Source)
at hedgehog.handler__init.<clinit>(Unknown Source)
... 18 stack levels elided ...
at hedgehog.handler_spec$eval1433$loading__4910__auto____1434.invoke(/Users/jason/estuary/hedgehog/spec/hedgehog/handler_spec.clj:1)
at hedgehog.handler_spec$eval1433.invoke(/Users/jason/estuary/hedgehog/spec/hedgehog/handler_spec.clj:1)
... 17 stack levels elided ...
at user$eval1262.invoke(NO_SOURCE_FILE)
... 4 stack levels elided ...
at leiningen.core.eval$fn__3507.invoke(eval.clj:304)
... 1 stack levels elided ...
at leiningen.core.eval$eval_in_project.invoke(eval.clj:326)
at leiningen.spec$spec.doInvoke(spec.clj:36)
... 5 stack levels elided ...
at leiningen.core.main$resolve_task$fn__2962.doInvoke(main.clj:151)
... 6 stack levels elided ...
at leiningen.core.main$apply_task.invoke(main.clj:192)
at lein_environ.plugin$write_env_to_file.invoke(plugin.clj:11)
... 4 stack levels elided ...
at robert.hooke$compose_hooks$fn__8566.doInvoke(hooke.clj:40)
... 2 stack levels elided ...
at robert.hooke$run_hooks.invoke(hooke.clj:46)
at robert.hooke$prepare_for_hooks$fn__8571$fn__8572.doInvoke(hooke.clj:54)
... 3 stack levels elided ...
at leiningen.core.main$resolve_and_apply.invoke(main.clj:196)
at leiningen.core.main$_main$fn__3025.invoke(main.clj:265)
at leiningen.core.main$_main.doInvoke(main.clj:252)
... 12 stack levels elided ...
Finished in 0.00000 seconds
1 examples, 0 failures, 1 errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment