title: How do I rebind a var in a Lazytest 'describe' test?
body: <p>First of all, sorry if I am screwing up some terminology; I'm pretty new to Clojure.  I am trying to write a very simple test using Lazytest that depends on a var binding.  I can not seem to rebind a var in the test file and have the code under test use that binding.</p>
  
  <p>Here is the code I am trying to test:</p>
  
  <pre><code>(ns liar-liar.core
    (:gen-class))
  
  (def *input-file-name*)
  
  (defn parse-input
    "Just print return a var for now..."
    []
    *input-file-name*)
  
  (defn -main [&amp; args]
    (binding [*input-file-name* (first args)]
      (println (parse-input))))
  </code></pre>
  
  <p>And here is the test:</p>
  
  <pre><code>(ns liar-liar.test.core
    (:use lazytest.describe)
    (:use liar-liar.core))
  
  (binding [*input-file-name* "my-input-file"]
    (describe parse-input "Just returns a var"
      (it "returns a var"
        (= "my-input-file" (parse-input)))))
  </code></pre>
  
  <p>When I try to run this test, I get this error:</p>
  
  <pre><code>java.lang.IllegalStateException: Var liar-liar.core/*input-file-name* is unbound.
  </code></pre>
  
  <p>Interestingly enough, if I move the binding form:</p>
  
  <pre><code>(ns liar-liar.test.core
    (:use lazytest.describe)
    (:use liar-liar.core))
  
  (describe parse-input "Just returns a var"
    (it "returns a var"
      (binding [*input-file-name* "my-input-file"]
        (= "FAIL" (parse-input)))))
  </code></pre>
  
  <p>The test works as it should, but the reporting isn't ideal, as it doesn't print the value of the (parse-input) expression (the test passes if I replace "FAIL" with "my-input-file" though):</p>
  
  <pre><code>FAILURE: Namespaces liar-liar.test.core #'liar-liar.core/parse-input Just returns a var returns a var
  at liar_liar/test/core.clj line 7
  Expression: (binding [*input-file-name* my-input-file] (= FAIL (parse-input)))
  Result: false
  Local bindings:
  {}
  </code></pre>
  
  <p>Is there some other way I should be going about doing this kind of testing?</p>
  
  <p>Thanks!
  Dan</p>