Fork me on GitHub
#testing
<
2018-10-10
>
fabrao20:10:01

Hello all, how can I use a clojure file that can be used for all my test files? I tried using in test/clj/util/common.clj but it says that can´t find it

fabrao20:10:34

I have the same fixture to my tests, so I have the common thing for all tests

seancorfield20:10:20

@fabrao You need to require it into each namespace that references it.

fabrao20:10:21

@seancorfield I did it, can I create any clojure file in test folder to include it in my tests?

(ns db.notificacao.atributo-test
  (:require
   [clojure.test :refer :all]
   [db.notificacao.regra :refer :all]
   [db.notificacao.atributo :refer :all]
   [util.comum :refer :all] <-
   ))

fabrao20:10:53

Unhandled java.io.FileNotFoundException
   Could not locate util/comum__init.class or util/comum.clj on
   classpath.

fabrao20:10:38

If I go to the file and load it in repl, it works

fabrao20:10:00

so I´m little lost how it works

seancorfield20:10:24

If you are in the REPL, can you (require 'db.notificacao.atributo-test) ?

fabrao20:10:02

yes, only the comum.clj is not loading

fabrao20:10:29

nevermind, it´s easier to include fixture in each test file