Fork me on GitHub
#beginners
<
2016-01-05
>
frankk3850615:01:01

instead of running

lein cucumber
to run all tests, how can I run a single feature test?

roberto16:01:16

i don’t know about cucumber, but normal clj tests you can do: lein test ns-of-test.test

agile_geek17:01:34

@frankk38506: been a long time (over 12 months) since I used lein-cucumber but I think you have to put a tag against the single feature you want to test and then pass the tag in a command line option e.g. if tag is @wip then lein cucumber --tags @wip But this is all from memory!

roberto17:01:35

can you run it from a repl too? Like plain clojure tests?

roberto17:01:48

(ns namespace-for-my-tests) (run-tests) ???

agile_geek17:01:57

I found lein-cucumber deeply annoying and ended up using https://github.com/xeqi/kerodon for my use cases alhtough they're not synonymous

roberto17:01:59

much faster than starting lein everytime

agile_geek17:01:48

@roberto: no - that's why I ditched it. It's really difficult to incorporate in the repl workflow

roberto17:01:09

yeah, that sucks then

agile_geek17:01:05

Having said that kerodon is only useful if your testing html served from ring.

agile_geek17:01:00

I think there's a big hole in the automated browser based testing story for Clojure/Clojurescript although I know most would say, test the API's extensively and the browser interaction less frequently.

jcomplex19:01:15

Suppose I had a collection: {:id 1 :name "Jane Doe" :images []}

jcomplex19:01:42

and I wanted to add [{:count 3 :monitor 12}] to :images

jcomplex19:01:46

is that allowed in clojure or do I have to create a completely new collection

jeff.engebretsen19:01:06

It's a new collection

user=> (def col {:id 1 :name "Jane Doe" :images []})
#'user/col
user=> (assoc col :images [{:count 3 :monitor 12}])
{:id 1, :name "Jane Doe", :images [{:count 3, :monitor 12}]}

akiva19:01:10

Actually, you’d probably rather use (update col :images conj {:count 3 :monitor 12}). I assume since :images is a vector, it’s going to have a number of entities.

jcomplex19:01:32

yes it will

agile_geek20:01:54

@jcomplex: the take away is that by default assoc and update will return a new map with the changes. (and conj returns a new sequence - a vector in this case)

agile_geek21:01:19

therefore your original map would be unchanged

agile_geek21:01:45

This is strange at first when you've come from a language that mutates values in place but after a while you just get used to passing new values up and down a chain of functions.

akiva21:01:32

Right, I should have pointed that out.