Package Exports
- smoking
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (smoking) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Smoking
Simple Mocks and Stubs for javascript.

$ npm install smokingOr add it to your script tag
https://raw.github.com/elcuervo/smoking/master/lib/smoking.jsStubbing
The idea is to provide simple mocking and stubbing to normal objects, no API, no dependencies.
Example
var Fruit = function(color) {
this.color = color;
this.healthy = 'yes';
};
Fruit.prototype = {
cutInPieces: function() {
return Math.floor(Math.random()*11);
}
};
var redFruit = new Fruit('red');
redFruit.color;
// 'red'
redFruit.healthy;
// 'yes'
redFruit.cutInPieces();
// 5
var stubbedRedFruit = smoking(redFruit, { healthy: 'a bit' });
stubbedRedFruit.healthy;
// 'a bit'
stubbedRedFruit.color;
// 'red'
stubbedRedFruit.cutInPieces();
// 2
redFruit.healthy;
// 'yes'
// You get the pointAnother
var uberChangedFruit = smoking(redFruit, {
color: 'blue',
cutInPieces: function() {
return 7;
}
});
uberChangedFruit.color;
// 'blue'
uberChangedFruit.cutInPieces();
// 7
uberChangedFruit.healthy;
// 'yes'Mocking
You can easily verify the call of methods.
var mockFruit = smoking(redFruit).expects({ cutInPieces: 1 });
mockFruit.cutInPieces();
smoking(mockFruit).verify();Or with a shorthand if it's just one method and needs to be called once
var mockFruit = smoking(redFruit).expects('cutInPieces');
smoking(mockFruit).verify();The prior example will fail with a RangeError because the 'cutInPieces' methods does not get called.
Name
It's a foca's idea :D.
