Skip to content

Instantly share code, notes, and snippets.

@pbadenski
Created May 10, 2010 14:17
Show Gist options
  • Save pbadenski/396084 to your computer and use it in GitHub Desktop.
Save pbadenski/396084 to your computer and use it in GitHub Desktop.
(use 'clojure.contrib.test-is)
(def now (new java.util.Date))
(defn date [year month day]
(new java.util.Date (- year 1900) (dec month) day))
(with-test
(defn business-method [date]
(let [after #(pos? (compare %1 %2))]
(if (after date now)
"expired")))
(binding [now (date 2010 5 10)]
(is (= (business-method (date 2010 5 10)) nil))
(is (= (business-method (date 2010 5 11)) "expired"))))
(run-tests)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment