Permalink
Browse files

Running specs in the REPL doesnt accumulate results any longer.

  • Loading branch information...
1 parent 721d98b commit e771ae6e2210f4914738d038cff796535acf0a74 @slagyr committed Aug 20, 2012
Showing with 14 additions and 4 deletions.
  1. +1 −0 CHANGES.md
  2. +11 −3 spec/speclj/run/standard_spec.clj
  3. +2 −1 src/speclj/run/standard.clj
View
@@ -2,6 +2,7 @@
* Includes lein template by @bcmcgavin to create new speclj projects. https://github.com/slagyr/speclj/pull/23
* Updates 'lein spec' task by @mylesmegyesi to be compatible with lein2 deprecations. https://github.com/slagyr/speclj/pull/24
+* Running specs in the REPL doesnt accumulate results any longer.
# 2.2.0
@@ -2,8 +2,8 @@
(:use
[speclj.core]
[speclj.run.standard]
- [speclj.running :only (run-directories)]
- [speclj.config :only (active-reporters)]
+ [speclj.running :only (run-directories run-and-report)]
+ [speclj.config :only (active-reporters *runner*)]
[speclj.report.silent :only (new-silent-reporter)]
[speclj.spec-helper :only (find-dir)])
(:import
@@ -21,6 +21,14 @@
(should= 0 (run-directories @runner [prime-factors-dir] @reporters)))
(it "returns lots-o failures when running failure example"
- (should= 8 (run-directories @runner [failures-dir] @reporters))))
+ (should= 8 (run-directories @runner [failures-dir] @reporters)))
+
+ (it "resets the results on each run"
+ (binding [*runner* @runner]
+ (describe "Test Describe" (it "runs" (should= 1 1))))
+ (run-and-report @runner @reporters)
+ (run-and-report @runner @reporters)
+ (should= 1 (count @(.results @runner))))
+)
(run-specs)
@@ -35,11 +35,12 @@
(swap! results into run-results)))
(run-and-report [this reporters]
+ (reset! results [])
(doseq [description @descriptions]
(run-description this description reporters))
(report-runs* reporters @results)))
(defn new-standard-runner []
(StandardRunner. (atom []) (atom [])))
-(swap! default-runner (fn [_] (new-standard-runner)))
+(reset! default-runner (new-standard-runner))

0 comments on commit e771ae6

Please sign in to comment.