I have a really basic question: If I want to test multiple assertions in a property test, what is the most idiomatic way to do it?
Is it just to wrap each assertion in an all
? Or can I leave them as separate forms?
I suppose I could wrap each in a clojure.test/is
but that seems definitely wrong
@ben606 are you using defspec
?
yes
the main two options are
1) Multiple defspecs
2) an and
inside a single defspec
there's tradeoffs
the and
could be made nicer if somebody wrote a version of and
that returned result-data about which branch failed
Okay, thanks @gfredericks. I guess this isn’t good practice, but I am testing things that depend on each other (db write and read). Seems like the Right Way would be to use multiple defspecs with some additonal setup/teardown?
@ben606 if you're doing something like "generate data, write it to the db, read it back, check that it's equivalent", then you'd want to do all of that in one defspec