Fix tests

This commit is contained in:
Tommi Reiman 2020-05-12 21:04:35 +03:00
parent 9e7df6ca03
commit 79c430d298
2 changed files with 6 additions and 5 deletions

View file

@ -5,7 +5,8 @@
[reitit.impl :as impl]
#?@(:clj [[ring.util.mime-type :as mime-type]
[ring.util.response :as response]])
[clojure.string :as str]))
[clojure.string :as str]
[reitit.exception :as ex]))
(declare get-match)
(declare get-router)
@ -99,9 +100,9 @@
:compile compile-result
::default-options-endpoint default-options-endpoint}
opts)]
(assert (not (contains? opts ::default-options-handler))
(str "Option `" ::default-options-handler "` is deprecated."
" Use `:" ::default-options-endpoint "` instead."))
(when (contains? opts ::default-options-handler)
(ex/fail! (str "Option :reitit.ring/default-options-handler is deprecated."
" Use :reitit.ring/default-options-endpoint instead.")))
(r/router data opts))))
(defn routes

View file

@ -206,7 +206,7 @@
(deftest default-options-handler-test
(testing "Assertion fails when using deprecated options-handler"
(is (thrown? java.lang.AssertionError (ring/router [] {::ring/default-options-handler (fn [_])})))))
(is (thrown? ExceptionInfo (ring/router [] {::ring/default-options-handler (fn [_])})))))
(deftest default-options-endpoint-test
(let [response {:status 200, :body "ok"}]