2 August 2021

Getting Started with 'speclj'

Just a 'speclj' of tests here and there...

The testing library speclj (pronounced "speckle") by Micah Martin integrates with lein (thanks to Colin Jones' template):

$ lein new speclj <project>
Generating a project called bowling2 based on the 'speclj' template.

After running that command you can run the tests with lein spec or, start a watcher to run your tests on-save:

$ cd <project>
$ lein spec -a
----- Mon Aug 02 13:41:01 MDT 2021 -------------------------------------------------------------------
took 0.03919 to determine file statuses.
reloading files:
  /Users/mike/Desktop/project/spec/project/core_spec.clj

a test
- FIXME, I fail. (FAILED)

Failures:

  1) a test FIXME, I fail.
     Expected: 0
          got: 1 (using =)
     /Users/mike/Desktop/project/spec/project/core_spec.clj:7

Finished in 0.00130 seconds
1 examples, 1 failures

<waiting for changes>

API documentation: http://micahmartin.com/speclj/

Note: Intellij (w/ Cursive) doesn't know how to run speclj tests natively, so add (run-specs) at the bottom of the *_spec.clj file, then right-click the file and select "Run '[project].core-spec'".