Created
September 19, 2011 16:23
-
-
Save marick/1226882 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns scratch.core | |
(:use midje.sweet | |
[clojure.set :only [union intersection]] | |
)) | |
(unfinished booking-transaction bookings) | |
(defn empty-history [] | |
[ [] ]) | |
(defn bookings [history] | |
(last history)) | |
(defn booking-transaction [history booking] | |
(conj history (conj (bookings history) booking))) | |
;.;. Achievement is its own reward. -- David Lynch | |
(facts "about the insert-animal transaction" | |
"inserting an animal into the empty database adds that animal" | |
(bookings (empty-history)) => [] | |
(let [new-history (booking-transaction (empty-history) [...animal...])] | |
(bookings new-history) => [ [...animal...] ] | |
(let [newer-history (booking-transaction new-history [...fred... ...betsy...])] | |
(bookings newer-history) => [ [...animal...] [...fred... ...betsy...] ]))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment