Menu
  • HOME
  • TAGS

Reusing a stub/redef across a speclj context

clojure,bdd,speclj

You can use the around macro to accomplish this. Here's an example spec: (ns sample.core-spec (:require [speclj.core :refer :all] [sample.core :refer :all])) (describe "a test" (it "returns output from fn-a" (should= 1 (fn-b))) (describe "using with-redef" (around [it] (with-redefs [fn-a (fn [] 2)] (it))) (it "returns the output from redefined...

Clojure Speclj with-redefs and a stub from a different thread

java,clojure,bdd,speclj

I coded up your example and the specs ran fine; passed without error. I can't think of a reason stubbing fns in a another namespace wouldn't work. I do it all the time. Here's a gist showing my work: https://gist.github.com/slagyr/2aed1ccfd8ec702d7051...

Is there a single command to run tests from both clojure.test and Speclj?

testing,clojure,functional-programming,leiningen,speclj

You could specify an alias in leiningen, add the following line to project.clj: :aliases {"test-all" ["do" ["test"] ["spec"]]} and run it with lein test-all...

How to make a test pending

testing,clojure,speclj

Let's start from simple spec: (describe "truthiness" (it "tests if my-fn returns true" (should (my-fn)))) To make (it "tests if my-fn returns true" ...) characteristic pending: (describe "truthiness" (it "tests if my-fn returns true" (pending "my-fn should be revisited") ; If message is not specified "Not Yet Implemented" will be...