testing assertion

This commit is contained in:
Caio Oliveira 2020-05-12 10:45:14 -04:00
parent 5e3e552c80
commit 029894b984
No known key found for this signature in database
GPG key ID: 45C322D391B0CA40
2 changed files with 7 additions and 1 deletions

View file

@ -100,7 +100,9 @@
::default-options-endpoint default-options-endpoint} ::default-options-endpoint default-options-endpoint}
opts)] opts)]
(assert (not (contains? opts ::default-options-handler)) (assert (not (contains? opts ::default-options-handler))
"Option `::default-options-handler` is deprecated. Use `::default-options-endpoint` instead.") (str
"Option `:reitit.ring/default-options-handler` is deprecated."
" Use `:reitit.ring/default-options-endpoint` instead."))
(r/router data opts)))) (r/router data opts))))
(defn routes (defn routes

View file

@ -205,6 +205,10 @@
(is (= 405 (:status (app {:request-method :post, :uri "/ping"})))))))))) (is (= 405 (:status (app {:request-method :post, :uri "/ping"}))))))))))
(deftest default-options-handler-test (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 [_] )})))))
(deftest default-options-endpoint-test
(let [response {:status 200, :body "ok"}] (let [response {:status 200, :body "ok"}]
(testing "with defaults" (testing "with defaults"