API for atticus.factory

by Unknown

Usage:
(ns your-namespace
  (:require atticus.factory))

Overview

Factory methods to generate defrecord instances for use in testing.  Inspired by
notahat's machinist gem.

You can refer to (lexically) previous fields when defining the factory.

     (defrecords make-rec my.ns.SomeRecord
       :n 1 :o (inc (:n %)))

     (make-rec)
       => {:n 1 :o 2}

Overriding a single value will cause it to be picked up in computed expressions
     (make-rec :n 2)
       => {:n 2 :o 3}

Computed fields can also be set explicitly.
   (make-user :o 1)
     => {:n 1 :o 1}

Public Variables and Functions



clj-fields

function
Usage: (clj-fields record-type)
Obtain a list of a defrecord's fields
Source


defrecords

macro
Usage: (defrecords name record-type & kw-vals)
Create a record factory function.

e.g. (defrecords make-rec my.ns.SomeRecord
       :n 1 :o (inc (:n %)))
Source


set-fields

function
Usage: (set-fields m obj)
Set the specified field values.
Source
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.