Questions tagged [midje]

Midje is a unit test framework for Clojure.

60 questions
0
votes
1 answer

Is there a way to have fixtures that are specific to a certain tests and not all in the given namespace?

just like midje lets us wrap facts in a with-state-changes form to specify what should run specifically before, around or after them or the content, how does one accomplish the same with clojure.test
Amogh Talpallikar
  • 12,084
  • 13
  • 79
  • 135
0
votes
1 answer

How to create my own checker in Midje?

I'm using Midje for a project. I've tried to find in the wiki how could I create my own checker, but couldn't find it. In my case, I want to compare if two images are equal. But it could be that I just want to compare some properties of the file, as…
thiagofm
  • 5,693
  • 4
  • 20
  • 26
0
votes
1 answer

testing clojure luminus application with midje

I'm doing tests on my luminus application and I want to test my post fuction as below. However, the data is posted on the body of the request object as a byte input stream. How do i make the data to be posted on the params key of the request object?…
joeabala
  • 266
  • 3
  • 11
0
votes
1 answer

`lein new midje myproject` using old midje and clojure versions

I noted that lein new midje myproject uses clojure 1.4.0 and midje 1.5.1 instead of 1.7.0 and 1.7.0. How can I tell lein new midje ... to use the latest versions? Here is my ? project.clj file: (defproject myproject "0.0.1-SNAPSHOT" :description…
user3639782
  • 487
  • 3
  • 10
0
votes
1 answer

Midje autotest not reloading files in Emacs Cider on Windows

I'm currently working through the Midje tutorial: https://github.com/marick/Midje/wiki/A-tutorial-introduction I load the repl using cider-jack-in and can successfully run (autotest) which runs the tests. However, when I change either the source or…
David Genn
  • 709
  • 4
  • 11
0
votes
1 answer

Midje's `with-state-changes` and function calls

The following code works (obviously): (use [midje.sweet]) (with-state-changes [(before :contents (println "setup") :after (println "teardown"))] (fact "one" (println "doing 1") 1 => 1) (fact "two" (println "doing 2") (+ 1 1) =>…
Sh4pe
  • 1,800
  • 1
  • 14
  • 30
0
votes
1 answer

Midje Project.clj giving error

I'm seeing an error on my ring server which I start with lein with-profile dev ring server java.io.FileNotFoundException: Could not locate midje/sweet__init.class or midje/sweet.clj on classpath: ,…
John
  • 4,362
  • 5
  • 32
  • 50
0
votes
0 answers

lein midje coudn't locate some file

I'm trying to do unit-testing using midje, and I hit some wall. Assuming I have this directory structure: ├── src │   └── clj │   └── faris │   └── lune │   ├── core.clj │   ├── index │   │   ├──…
Faris Nasution
  • 3,450
  • 5
  • 24
  • 29
0
votes
3 answers

Stub out internal function calls in Midje

I'm testing a function that uses two other functions from other namespace. (fact "a test" (let [result (function-that-uses-functions-from-other-namespace)] result => truthy)) I want to stub out the functions from other namespace and I'm…
sumek
  • 26,495
  • 13
  • 56
  • 75
0
votes
0 answers

Midje tests with maven test

I am using Clojure maven plugin and I have written tests using both clojure.test and midje. Clojure.test integrates well with maven and mvn test runs all tests, whereas midje tests are evaluated but not reported from mvn test. I found a post on…
srnvs
  • 997
  • 2
  • 10
  • 22
0
votes
2 answers

Ignoring authentication in unit tests in Clojure web app using Friend?

I'm using friend for protecting some pages in my web application, which is working fine so far. I'm running into issues with my test code, though: I seem to be unable to work around the authentication mechanism or to mock out friend's authorize…
schaueho
  • 3,419
  • 1
  • 21
  • 32
0
votes
1 answer

In Clojure and Midje, how can I write prerequisites for an indirect call?

In the following code, I'd like to test the foo function before implementing the bar function. (unfinished bar) (def tbl {:ev1 bar}) (defn foo [ev] ((tbl ev))) (fact "about an indirect call" (foo :ev1) => nil (provided (bar) => nil)) But…
gpsoft
  • 43
  • 5
0
votes
1 answer

I cannot run tests in clojure/midje

I run tests with: lein midje :autotest And I get error: Exception in thread "main" java.lang.Exception: No namespace: sprint-is.json-export found File is in: sprint-is/src/sprint_is/json_export.clj It contains code: (ns…
Jiri Knesl
  • 225
  • 1
  • 2
  • 7
0
votes
1 answer

how can lein midje :autotest be made to work with immutant?

I'm migrating a application I did in ring over to immutant and and a bit lost as to what to do with all my tests. Because immutant projects are required to be deployed, what is the best strategy to test the functionality?
zcaudate
  • 13,998
  • 7
  • 64
  • 124
0
votes
1 answer

Clojure Midje 'provided' When Using 'pcalls'

I'm reasonably new to Clojure, and am trying to parallelize some calls to a function. Let's say I have a map as follows: {:a 1 :b 2 :c 3} and I want to use the keys and values as arguments of a function called my-function, with the function called…
dmcgillen
  • 465
  • 5
  • 15
1 2 3
4