Permalink
Browse files

started documentation in the README

  • Loading branch information...
slagyr committed Nov 24, 2010
1 parent 2afeda2 commit d851d8839cbd0793250b22fdf53e7e673a423d32
Showing with 224 additions and 101 deletions.
  1. +140 −91 .idea/workspace.xml
  2. +57 −9 README.md
  3. +12 −0 examples/basics/basic_spec.clj
  4. +1 −1 project.clj
  5. +8 −0 spec/speclj/should_spec.clj
  6. +6 −0 src/speclj/core.clj
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,17 +1,65 @@
-# mmspec
+# speclj #
+### (pronounced "speckle" [spek-uhl]) ###
+It's a TDD/BDD framework for [Clojure](http://clojure.org/). Based quite loyally on [RSpec](http://rspec.info/).
-FIXME: write description
+# Installation
-## Usage
+TODO
-FIXME: write
+# Usage
-## Installation
+## Speclj 101
+Checkout this example. Below we'll look at it piece by piece.
-FIXME: write
+ (ns basics-spec
+ (:use [speclj.core]))
-## License
+ (describe "Truth"
-Copyright (C) 2010 FIXME
+ (it "is true"
+ (should true))
-Distributed under the Eclipse Public License, the same as Clojure.
+ (it "is not false"
+ (should-not false)))
+
+ (conclude-single-file-run)
+
+### `speclj.core` namespace
+Your spec files should `:use` the `speclj.core` in it's entirety. It's a clean namespace and you're likely going to use all the definitions within it.
+
+ (:use [speclj.core])
+
+### `#describe`
+`describe` is the outer most container for specs. It takes a `String` name and any number of _spec components_.
+
+ (describe "Truth" ...)
+
+### `it`
+`it` specifies a _characteristic_ of the subject. This is where assertions go. Be sure to provide good names as the first parameter of `it` calls.
+
+ (it "is true" ...)
+
+### `should` and `should-not`
+Assertions. All assertions begin with `should`. `should` and `should-not` are just two of the many matchers available. They both take expressions that they will check for truthy-ness and falsy-ness respectively.
+
+ (should ...)
+ (should-not ...)
+
+# Contributing
+Clone the master branch, build, and run all the tests:
+
+ git clone https://github.com/slagyr/speclj.git
+ cd speclj
+ lein javac
+ lein spec
+
+Make patches and submit them along with an issue (see below).
+
+## Issues
+Post issues on the speclj github project:
+
+* [https://github.com/slagyr/speclj/issues](https://github.com/slagyr/speclj/issues)
+
+# License
+Copyright (C) 2010 Micah Martin All Rights Reserved.
+Distributed under the The MIT License.
@@ -0,0 +1,12 @@
+(ns basics-spec
+ (:use [speclj.core]))
+
+(describe "Truth"
+
+ (it "is true"
+ (should true))
+
+ (it "is not false"
+ (should-not false)))
+
+(conclude-single-file-run)
View
@@ -2,7 +2,7 @@
(defproject speclj speclj.version/string
:description "speclj: Pronounced 'speckle', is a Behavior Driven Development framework for Clojure."
- :license {:name "MIT"
+ :license {:name "The MIT License"
:url "file://LICENSE"
:distribution :repo
:comments "Copyright © 2010 Micah Martin All Rights Reserved."}
@@ -9,6 +9,10 @@
(should-pass! (should true))
(should-fail! (should false)))
+ (it "should-not tests falsy"
+ (should-fail! (should-not true))
+ (should-pass! (should-not false)))
+
(it "should= tests equality"
(should-pass! (should= 1 1))
(should-pass! (should= "hello" "hello"))
@@ -19,6 +23,10 @@
(should= "Expected truthy but was: <false>" (failure-message (should false)))
(should= "Expected truthy but was: <>" (failure-message (should nil))))
+ (it "should failure message is nice"
+ (should= "Expected falsy but was: <true>" (failure-message (should-not true)))
+ (should= "Expected falsy but was: <1>" (failure-message (should-not 1))))
+
(it "should= failure message is nice"
(should=
(str "Expected: <1>" endl " got: <2> (using =)")
View
@@ -45,6 +45,12 @@
(if-not value#
(throw (SpecFailure. (str "Expected truthy but was: <" value# ">"))))))
+
+(defmacro should-not [expr]
+ `(let [value# ~expr]
+ (if value#
+ (throw (SpecFailure. (str "Expected falsy but was: <" value# ">"))))))
+
(defmacro should= [expr1 expr2]
`(let [expected# ~expr1 actual# ~expr2]
(if (not (= expected# actual#))

0 comments on commit d851d88

Please sign in to comment.