branch: elpa/buttercup
commit a535e5196f7ea8204476d8336f37f4e18be62dec
Author: Ryan C. Thompson <r...@thompsonclan.org>
Commit: Jorgen Schäfer <jorgen.schae...@gmail.com>

    Fix a logic error in spy tests
    
    If "before-each" is used, then some tests, like "restores the old
    value after a spec run", become meaningless, since the before-each
    form is always going to restore the value anyway. This commit uses
    "before-all" instead.
---
 tests/test-buttercup.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index e488b61..629f043 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -505,7 +505,10 @@
 
 (describe "The Spy "
   (let (test-function)
-    (before-each
+    ;; We use `before-all' here because some tests need to access the
+    ;; same function as previous tests in order to work, so overriding
+    ;; the function before each test would invalidate those tests.
+    (before-all
       (fset 'test-function (lambda (a b)
                              (+ a b))))
 

Reply via email to