diff --git a/src/circumspec/raw.clj b/src/circumspec/raw.clj index 7808f64..4bf97ec 100644 --- a/src/circumspec/raw.clj +++ b/src/circumspec/raw.clj @@ -5,7 +5,8 @@ (defn dump-file "Create dump file name for a test run" [] - (File. ".circumspec/raw/" (.toString (java.util.Date.)))) + (File. (str ".circumspec/raw/" (.replace (.toString (java.util.Date.)) \: \_)))) + ; Replace colons with underscores for windows compatibility (defn dump-results "Spit results into a file, return java.io.File instance." diff --git a/test/circumspec/raw_test.clj b/test/circumspec/raw_test.clj index c62235f..9c724ba 100644 --- a/test/circumspec/raw_test.clj +++ b/test/circumspec/raw_test.clj @@ -1,15 +1,22 @@ (ns circumspec.raw-test - (:use circumspec circumspec.raw)) + (:use circumspec circumspec.raw) + (:import java.io.File) + ) ;; TODO: better filename convention (describe dump-file (it "creates a file in .circumspec/raw" - (let [file (dump-file)] + (let [file (dump-file) + separator (java.io.File/separator) + escapedSeparator (if (= separator "\\") "\\\\" (str separator)) + filePattern (str "[.]circumspec" escapedSeparator "raw" escapedSeparator ".*") + ] (should (instance? java.io.File file)) - (should (re-find #"\.circumspec/raw/.*" (.toString file)))))) + (should (not (re-find #":" (.toString file)))) + (should (re-find (re-pattern filePattern) (.toString file)))))) (describe dump-results - (it "writes complete restuls to a file" + (it "writes complete results to a file" (let [file (dump-results (take 2 (repeat {:sample true})))] (should (= "{:sample true}\n{:sample true}\n" (slurp (.toString file)))) (should (.delete file) "deleting sample result data")))) \ No newline at end of file