Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Provides a mock evironment for testing CouchDB design document functions
CoffeeScript
tag: 0.0.1

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
spec
src
.gitignore
LICENSE
Makefile
README
package.json

README

CouchCover
==========

A mock environment for using Node.js to test CouchDB design document functions.

Usage
=====

    # Forgive the Coffee-colored syntax...
    CouchCover = require 'CouchCover'
    assert = require 'assert'
    
    # Let's load up the design doc!
    ddoc = new CouchCover.DesignDoc {
      foo: '''
        function(s) {
          return "From foo: " + s "!";
        }
      '''
    }
      
    # Now, let's call function 'foo' with argument 'bar':
    retVal = ddoc.call 'foo', ['bar']
    
    # And note the return value
    assert.equal 'From foo: bar!', retVal
    
    # You can also get a reference, and call that:
    fooFun = ddoc.compile 'foo'
    retVal = fooFun.call 'bar'
    
    # And note the return value
    assert.equal 'From foo: bar!', retVal

Dependencies
============

There are currently no run-time dependencies, but you do need CoffeeScript to hack this package.

TODOs
=====

* Show usage of require() and log() functions from ddoc code
* CouchFunction subtypes for View, List, Show, Update and Filter functions
* Sandbox overrides
* API documentation 
Something went wrong with that request. Please try again.