Merge branch 'danfinnie-any-vs-anything-error'
This commit is contained in:
@@ -2384,6 +2384,12 @@ getJasmineRequireObj().TreeProcessor = function() {
|
|||||||
getJasmineRequireObj().Any = function(j$) {
|
getJasmineRequireObj().Any = function(j$) {
|
||||||
|
|
||||||
function Any(expectedObject) {
|
function Any(expectedObject) {
|
||||||
|
if (typeof expectedObject === 'undefined') {
|
||||||
|
throw new TypeError(
|
||||||
|
'jasmine.any() expects to be passed a constructor function. ' +
|
||||||
|
'Please pass one or use jasmine.anything() to match any object.'
|
||||||
|
);
|
||||||
|
}
|
||||||
this.expectedObject = expectedObject;
|
this.expectedObject = expectedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,4 +42,11 @@ describe("Any", function() {
|
|||||||
expect(any.jasmineToString()).toEqual('<jasmine.any(Number)>');
|
expect(any.jasmineToString()).toEqual('<jasmine.any(Number)>');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("when called without an argument", function() {
|
||||||
|
it("tells the user to pass a constructor or use jasmine.anything()", function() {
|
||||||
|
expect(function() {
|
||||||
|
new j$.Any();
|
||||||
|
}).toThrowError(TypeError, /constructor.*anything/);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
getJasmineRequireObj().Any = function(j$) {
|
getJasmineRequireObj().Any = function(j$) {
|
||||||
|
|
||||||
function Any(expectedObject) {
|
function Any(expectedObject) {
|
||||||
|
if (typeof expectedObject === 'undefined') {
|
||||||
|
throw new TypeError(
|
||||||
|
'jasmine.any() expects to be passed a constructor function. ' +
|
||||||
|
'Please pass one or use jasmine.anything() to match any object.'
|
||||||
|
);
|
||||||
|
}
|
||||||
this.expectedObject = expectedObject;
|
this.expectedObject = expectedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user