Smoking
Simple Mocks and Stubs for javascript.
$ npm install smoking
Or add it to your script tag
https://raw.github.com/elcuervo/smoking/master/lib/smoking.js
Stubbing
The idea is to provide simple mocking and stubbing to normal objects, no API, no dependencies.
Example
var { thiscolor = color; thishealthy = 'yes';}; Fruitprototype = { return Math; }; var redFruit = 'red'; redFruitcolor;// 'red'redFruithealthy;// 'yes'redFruit;// 5 var stubbedRedFruit = ; stubbedRedFruithealthy;// 'a bit'stubbedRedFruitcolor;// 'red'stubbedRedFruit;// 2redFruithealthy;// 'yes'// You get the point
Another
var uberChangedFruit = ; uberChangedFruitcolor;// 'blue'uberChangedFruit;// 7uberChangedFruithealthy;// 'yes'
Mocking
You can easily verify the call of methods.
var mockFruit = ;mockFruit;;
Or with a shorthand if it's just one method and needs to be called once
var mockFruit = ;;
The prior example will fail with a RangeError because the 'cutInPieces' methods does not get called.
Name
It's a foca's idea :D.