Comparing version
@@ -35,3 +35,2 @@ /* | ||
var Expectations = function() { | ||
var timesCalled = 0; | ||
@@ -205,3 +204,2 @@ var calledWithArgs = {}; | ||
}()); | ||
}; | ||
@@ -208,0 +206,0 @@ |
@@ -21,2 +21,4 @@ 'use strict'; | ||
function methods(obj) { | ||
//Properties which cannot be accessed in strict mode | ||
var reservedProperties = ['caller', 'callee', 'arguments']; | ||
var funcs = []; | ||
@@ -33,4 +35,4 @@ | ||
_.forEach(methodsOnObj, function(value) { | ||
var member = typeof(obj[value]); | ||
if (member === 'function') { | ||
if (reservedProperties.indexOf(value) === -1 && | ||
obj[value] instanceof Function) { | ||
funcs.push(value); | ||
@@ -37,0 +39,0 @@ } |
{ | ||
"name": "deride", | ||
"description": "Mocking library based on composition", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"homepage": "https://github.com/REAANDREW/deride", | ||
@@ -32,12 +32,12 @@ "author": { | ||
"devDependencies": { | ||
"blanket": "~1.1.6", | ||
"grunt": "~0.4.4", | ||
"grunt-blanket": "0.0.8", | ||
"grunt-contrib-jshint": "~0.10.0", | ||
"grunt-contrib-nodeunit": "~0.2.0", | ||
"grunt-contrib-watch": "~0.6.1", | ||
"grunt": "~0.4.4", | ||
"sinon": "~1.9.1", | ||
"grunt-mocha-test": "~0.10.2", | ||
"grunt-notify": "~0.2.20", | ||
"grunt-mocha-test": "~0.10.2", | ||
"grunt-blanket": "0.0.8", | ||
"blanket": "~1.1.6", | ||
"grunt-pmkr-license": "~1.1.0" | ||
"should": "^4.0.4", | ||
"sinon": "~1.9.1" | ||
}, | ||
@@ -44,0 +44,0 @@ "keywords": [], |
@@ -280,26 +280,2 @@ # deride [](https://travis-ci.org/REAANDREW/deride) [](http://badge.fury.io/js/deride) [](https://david-dm.org/REAANDREW/deride) | ||
## Release History | ||
- v0.1.0 - 22nd April 2014 | ||
- First release of the library, pushed into the NPM registry | ||
- v0.1.4 - 24nd April 2014 | ||
- Bug fixes and support for different method definition styles | ||
- v0.1.5 - 24nd April 2014 | ||
- Added feature to support overriding a callback | ||
- v0.1.6 - 25th April 2014 | ||
- Added feature to support accelerating the timeout used internally by a function | ||
- v0.1.8 - 28th April 2014 | ||
- Pull request from stono to support custom error messages | ||
- Made the withArgs evaluate equivalence of the args not strict object equality | ||
- v0.1.9 - 29th April 2014 | ||
- Pull request from stono to eliminate some duplication | ||
- Pull request from jamlen to fix the dependencies badge | ||
- Enable stubbing an existing object to generate the method names which exist on the target object | ||
- Enable creating a single mocked method with all the setup and expectation capabilities | ||
## License | ||
@@ -306,0 +282,0 @@ Copyright (c) 2014 Andrew Rea |
@@ -30,6 +30,33 @@ /* | ||
var deride = require('../lib/deride.js'); | ||
var utils = require('../lib/utils'); | ||
var _ = require('lodash'); | ||
var util = require('util'); | ||
var assert = require('assert'); | ||
require('should'); | ||
describe('utils', function(){ | ||
it('finds object style methods', function(){ | ||
var obj = { | ||
greet : function(){}, | ||
depart : function(){} | ||
}; | ||
utils.methods(obj).should.eql(['greet', 'depart']); | ||
}); | ||
it('finds protoype style methods', function(){ | ||
function Obj(){} | ||
Obj.prototype.greet = function(){}; | ||
Obj.prototype.depart = function(){}; | ||
utils.methods(new Obj()).should.eql(['greet', 'depart']); | ||
}); | ||
it('finds methods attached to functions', function(){ | ||
function obj(){} | ||
obj.greet = function(){}; | ||
obj.depart = function(){}; | ||
utils.methods(obj).should.eql(['greet', 'depart']); | ||
}); | ||
}); | ||
describe('Excpectations', function() { | ||
@@ -36,0 +63,0 @@ it('does not invoke original method when override method body', function() { |
Sorry, the diff of this file is not supported yet
712
3.64%35791
-0.03%285
-7.77%