Skip to content

Commit

Permalink
Merge branch 'master' of github.com:MichaelDrogalis/zombie
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Drogalis committed Oct 19, 2012
2 parents bc63803 + b20997c commit e283da5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# zombie

A Clojure framework to rapidly spawn data sets. Sometimes during testing, concrete values don't matter. All that matters is semantics. Capture the essence of your test cases with zombie. See below for usage.
A Clojure framework for declarative semantic data transformation. Sometimes during testing, concrete values don't matter. All that matters is semantics. Capture the essence of your test cases with zombie. See below for usage.

## Installation

Expand All @@ -10,6 +10,32 @@ Add the following to your `:dependencies`

## Usage

I'll motivate the usage by first demonstrating zombie's full power. Later we'll break it down. Let's say I have a function:

```clojure
(defn alcohol-legal [people]
(filter #(>= (:age %) 21) people))
```

I could write a test such as:

```clojure
(deftest mike-is-legal
(let [mike {:name "Mike" :age 21}
pete {:name "Pete" :age 18}]
(is (= [mike] (alcohol-legal [mike pete])))))
```

But what's the essence of the test? Does Pete's name matter? Does the fact that he's *exactly* 18 matter? Nope. All the matters is that there's someone else that's under 21. Declarative semantic transformations do this better.

```clojure
(deftest mike-is-legal
(spawn {}
[mike {:name "Mike" :age 21}
_ (is-like mike (but-he (has-a-lesser :age)))]
(is (= [mike] (alcohol-legal zombies)))))
```

A little session at the REPL shows how to leverage Zombie to make new data.

```clojure
Expand Down Expand Up @@ -45,6 +71,7 @@ Data can be manipulated with the following functions:

has-a-different
has-a-smaller
has-a-lesser
has-no
has-a-nil
has-a
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(defproject zombie "0.2.0"
:description "Clojure test data specifications that won't make you want to punch a window."
:description "Clojure declarative semantic data transformations made easy."
:url "https://github.com/MichaelDrogalis/zombie"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
Expand Down

0 comments on commit e283da5

Please sign in to comment.