forked from stuarthalloway/circumspec
/
raw_test.clj
22 lines (20 loc) · 847 Bytes
/
raw_test.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(ns circumspec.raw-test
(: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)
separator (java.io.File/separator)
escapedSeparator (if (= separator "\\") "\\\\" (str separator))
filePattern (str "[.]circumspec" escapedSeparator "raw" escapedSeparator ".*")
]
(should (instance? java.io.File file))
(should (not (re-find #":" (.toString file))))
(should (re-find (re-pattern filePattern) (.toString file))))))
(describe dump-results
(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"))))