Squashed matchers refactor - matchers now unit-testable apart from Expectation and Spec.
This commit is contained in:
32
src/core/Any.js
Normal file
32
src/core/Any.js
Normal file
@@ -0,0 +1,32 @@
|
||||
getJasmineRequireObj().Any = function() {
|
||||
|
||||
function Any(expectedObject) {
|
||||
this.expectedObject = expectedObject;
|
||||
}
|
||||
|
||||
Any.prototype.jasmineMatches = function(other) {
|
||||
if (this.expectedObject == String) {
|
||||
return typeof other == 'string' || other instanceof String;
|
||||
}
|
||||
|
||||
if (this.expectedObject == Number) {
|
||||
return typeof other == 'number' || other instanceof Number;
|
||||
}
|
||||
|
||||
if (this.expectedObject == Function) {
|
||||
return typeof other == 'function' || other instanceof Function;
|
||||
}
|
||||
|
||||
if (this.expectedObject == Object) {
|
||||
return typeof other == 'object';
|
||||
}
|
||||
|
||||
return other instanceof this.expectedObject;
|
||||
};
|
||||
|
||||
Any.prototype.jasmineToString = function() {
|
||||
return '<jasmine.any(' + this.expectedClass + ')>';
|
||||
};
|
||||
|
||||
return Any;
|
||||
};
|
||||
Reference in New Issue
Block a user