Remove 'actual' param from matchers test and message functions. Use this.actual instead. This way, the signature of the test function matches how the matcher is called from a spec.

Spy matchers now throw an exception when called with non-spies, rather than returning false.  This makes the message function simpler, and will work better with future dot-not support.
Added better specs for error conditions on spy matchers.
This commit is contained in:
Christian Williams
2009-11-12 12:47:44 -05:00
parent 2a5754600a
commit 1b3545c82a
3 changed files with 134 additions and 148 deletions

View File

@@ -324,6 +324,16 @@ jasmine.createSpy = function(name) {
return spyObj;
};
/**
* Determines whether an object is a spy.
*
* @param {jasmine.Spy|Object} putativeSpy
* @returns {Boolean}
*/
jasmine.isSpy = function(putativeSpy) {
return putativeSpy && putativeSpy.isSpy;
};
/**
* Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something
* large in one call.