Permalink
Browse files

fixed bug introduced in 2.1.2 release

  • Loading branch information...
1 parent 91a654c commit 9b326368264109444c9f455908f7e673db450e07 @AlexBaranosky AlexBaranosky committed Feb 22, 2013
Showing with 14 additions and 8 deletions.
  1. +1 −1 README.md
  2. +1 −1 project.clj
  3. +10 −6 src/conjure/core.clj
  4. +2 −0 test/conjure/core_test.clj
View
@@ -7,7 +7,7 @@ Usage
=====
```clj
-[org.clojars.runa/conjure "2.1.2"]
+[org.clojars.runa/conjure "2.1.3"]
(:require [conjure.core])
```
View
@@ -1,6 +1,6 @@
(def common-deps '[])
-(defproject org.clojars.runa/conjure "2.1.2"
+(defproject org.clojars.runa/conjure "2.1.3"
:description "Conjure mocking and stubbing"
:dependencies ~(cons '[org.clojure/clojure "1.3.0"]
common-deps)
View
@@ -23,17 +23,21 @@
called, and to return the return-value specified. The actual function is never called.
This is used internally by Conjure."
[f return-value]
- (fn this [& args]
- (swap! call-times update-in [this] conj (vec args))
- (return-value-for-stub-fn return-value (vec args))))
+ (let [stubbed-f (fn this [& args]
+ (swap! call-times update-in [this] conj (vec args))
+ (return-value-for-stub-fn return-value (vec args)))]
+ (swap! call-times assoc stubbed-f [])
+ stubbed-f))
(defn instrumented-fn
"Wraps a function, instrumenting it to record information about when it was
called. The actual function is still called. This is used internally by Conjure."
[f]
- (fn this [& args]
- (swap! call-times update-in [this] conj (vec args))
- (apply f args)))
+ (let [instrumented-f (fn this [& args]
+ (swap! call-times update-in [this] conj (vec args))
+ (apply f args))]
+ (swap! call-times assoc instrumented-f [])
+ instrumented-f))
(defn stub-fn-with-return-vals
"Creates a anonymous function that, on each successive call, returns the next
@@ -25,6 +25,8 @@
(deftest test-basic-mocking
(mocking [xx yy]
+ (verify-call-times-for xx 0)
+ (verify-call-times-for yy 0)
(fn-under-test)
(verify-call-times-for xx 1)
(verify-call-times-for yy 1)

0 comments on commit 9b32636

Please sign in to comment.