Skip to content

Commit

Permalink
testing assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
caioaao committed May 12, 2020
1 parent 5e3e552 commit 029894b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/reitit-ring/src/reitit/ring.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/cljc/reitit/ring_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 029894b

Please sign in to comment.