0

I'm trying to do this:

(defn pilot-ready [args] [2])

(defn ready []
  (pilot-ready ["hello"]))

(facts
  (ready) => [1]
  (provided (pilot-ready ["hello"]) => [1]))

(against-background
  [(pilot-ready ["hello"]) => [1]]
  (fact
    (ready) => [1]))

What's this supposed to do, is stub the pilot ready method, and make it return [1] for the argument ["hello"]

The first fact fails with:

FAIL at (innkeeper_paths_client_facts.clj:53)
These calls were not made the right number of times:
    (pilot-ready ["hello"]) [expected at least once, actually never called]

FAIL at (innkeeper_paths_client_facts.clj:52)
    Expected: [1]
      Actual: [2]
       Diffs: in [0] expected 1, was 2
=> false

The second with:

FAIL at (innkeeper_paths_client_facts.clj:58)
    Expected: [1]
      Actual: [2]
       Diffs: in [0] expected 1, was 2
=> false

Can someone help me figure out what am I doing wrong?

Danix
  • 1,947
  • 1
  • 13
  • 18
  • 1
    Your example works for me. Just generated a project using the midje template and threw the code in there. – kongeor Jun 10 '16 at 09:28
  • True, for a newly generated project it works. Now I have a solution for my project also. Thanks! – Danix Jun 10 '16 at 14:45

1 Answers1

0

The problem was this line, in the project.clj file:

:jvm-opts ^:replace ["-Dclojure.compiler.direct-linking=true"]
Danix
  • 1,947
  • 1
  • 13
  • 18