This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-18
Channels
- # beginners (22)
- # boot (12)
- # cider (3)
- # cljs-dev (12)
- # cljsrn (8)
- # clojure (101)
- # clojure-nl (5)
- # clojure-russia (13)
- # clojure-spec (5)
- # clojure-uk (15)
- # clojurescript (158)
- # cursive (5)
- # datascript (16)
- # datomic (8)
- # hoplon (11)
- # lumo (33)
- # off-topic (3)
- # om (25)
- # parinfer (1)
- # pedestal (8)
- # protorepl (4)
- # re-frame (8)
- # reagent (5)
- # specter (18)
- # sql (1)
- # testing (11)
- # timbre (1)
- # unrepl (2)
- # untangled (1)
Hi! does anyone know where to find a good example on how to use clojure.test/report
to build custom assertion functions? (I understand that’s the way to go rather than wrapping clojure.test/is
)
@facundo: the way to do that is by defining new methods of the assert-expr
multimethod. From the clojure.test ns dictating:
EXTENDING TEST-IS (ADVANCED)
You can extend the behavior of the \"is\" macro by defining new
methods for the \"assert-expr\" multimethod. These methods are
called during expansion of the \"is\" macro, so they should return
quoted forms to be evaluated.
I don't have an example at handHere you can find some examples from clojure.test itself: https://github.com/clojure/clojure/blob/master/src/clj/clojure/test.clj#L491
thanks for the answer @nberger ! that code was useful, but I figure I wasn’t accurate when I said assertion functions
I actually want to create a function to use instead of is
rather that something to call inside is
I already have a working version of what I want, but wrapping is
calls. It goes something like this:
(deftest application-crud
(testing "create a new app"
(-> (POST "/api/v1/management/applications" {:name "my-app"})
(expect :status 201
:body {:name “my-app”}))))