Fork me on GitHub
#beginners
<
2017-04-15
>
timo08:04:26

What is the state of testing in clojure? I want to use bdd, what should I use? speclj?

timo09:04:12

Specification by example would be great

algiras09:04:08

I am looking for a way to check if json that I am getting conforms to clojure spec. Problem is spec requires keys to be localized like ::a ::b , but when I use cheshire I get :a 😛. I am currently using clojure.spec/valid? to check if json conforms to spec is there something else I should be using?

shan11:04:42

@algiras it looks like you can use :req-un if you want to validate keys

algiras11:04:21

Ou, your right! I tried it before and in specified :req-un [:a :b] and it failed. I just tried it using :req-un [::a ::b] and it worked. Thx

algiras12:04:26

Is there any convention on how to keep your spec descriptions, should they be separated from the code or intermingled? If intermingled, should it be at the top of the file or before using a var and function that was described?

didibus04:04:21

algiras: It's still being determined. Different people have some different preference, but no way is ideal yet, they each have different trade offs.

algiras07:04:06

Thx for the reply. Hope until Clojure 1.9 stable release there will be some common good practices.

shan12:04:12

I haven’t used it personally, but I remember this reddit thread discussing some conventions: https://www.reddit.com/r/Clojure/comments/5ewv8f/spec_and_code_organization/

algiras12:04:16

Cool thx, hope at the near future I will have enough knowledge to contribute to these discussion.

josh.freckleton19:04:50

I'm reading some code that has (.. Config. <stuff> ), what exactly is that first ..?

josh.freckleton19:04:35

Is it this? (.. Config. (a) (b) (c option)) => Config.a().b().c(option)

noisesmith20:04:28

it's like -> but only for method calls, so yes

noisesmith20:04:07

@josh.freckleton amazingly (doc ..) works

noisesmith20:04:23

(not sarcastic, I wanted to double check something as syntaxy as that would have docs)