From 029894b9845f2237b89ba4fbe47f5d1f789ab458 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Tue, 12 May 2020 10:45:14 -0400 Subject: [PATCH] testing assertion --- modules/reitit-ring/src/reitit/ring.cljc | 4 +++- test/cljc/reitit/ring_test.cljc | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/reitit-ring/src/reitit/ring.cljc b/modules/reitit-ring/src/reitit/ring.cljc index 3585caf8a..c408d8910 100644 --- a/modules/reitit-ring/src/reitit/ring.cljc +++ b/modules/reitit-ring/src/reitit/ring.cljc @@ -100,7 +100,9 @@ ::default-options-endpoint default-options-endpoint} opts)] (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)))) (defn routes diff --git a/test/cljc/reitit/ring_test.cljc b/test/cljc/reitit/ring_test.cljc index 4a5ecbb40..cdb919f96 100644 --- a/test/cljc/reitit/ring_test.cljc +++ b/test/cljc/reitit/ring_test.cljc @@ -205,6 +205,10 @@ (is (= 405 (:status (app {:request-method :post, :uri "/ping"})))))))))) (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"}] (testing "with defaults"