Created
May 10, 2010 14:17
-
-
Save pbadenski/396084 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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