Merge branch 'master' into dot-not

This commit is contained in:
Christian Williams
2010-02-27 11:57:15 -05:00
47 changed files with 2957 additions and 2332 deletions

View File

@@ -48,7 +48,7 @@ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
}
if (this.reportWasCalled_) return result;
var message;
if (!result) {
if (this.message) {
@@ -215,15 +215,32 @@ jasmine.Matchers.prototype.wasNotCalled = function() {
*
*/
jasmine.Matchers.prototype.wasCalledWith = function() {
var expectedArgs = jasmine.util.argsToArray(arguments);
if (!jasmine.isSpy(this.actual)) {
throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
}
this.message = function() {
if (this.actual.callCount == 0) {
return "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but it was never called.";
} else {
return "Expected spy to have been called with " + jasmine.pp(expectedArgs) + " but was called with " + jasmine.pp(this.actual.argsForCall);
}
};
return this.env.contains_(this.actual.argsForCall, expectedArgs);
};
jasmine.Matchers.prototype.wasNotCalledWith = function() {
var expectedArgs = jasmine.util.argsToArray(arguments);
if (!jasmine.isSpy(this.actual)) {
throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
}
this.message = function() {
return "Expected spy to have been called with " + jasmine.pp(arguments) + " but was called with " + jasmine.pp(this.actual.argsForCall);
return "Expected spy not to have been called with " + jasmine.pp(expectedArgs) + " but it was";
};
return this.env.contains_(this.actual.argsForCall, jasmine.util.argsToArray(arguments));
return !this.env.contains_(this.actual.argsForCall, expectedArgs);
};
/**

View File

@@ -15,7 +15,7 @@ jasmine.unimplementedMethod_ = function() {
/**
* Use <code>jasmine.undefined</code> instead of <code>undefined</code>, since <code>undefined</code is just
* a plain old variable and may be redefined by somebody else.
*
*
* @private
*/
jasmine.undefined = jasmine.___undefined___;
@@ -66,7 +66,7 @@ jasmine.ExpectationResult = function(params) {
/** @deprecated */
this.details = params.details;
this.message = this.passed_ ? 'Passed.' : params.message;
this.trace = this.passed_ ? '' : new Error(this.message);
};
@@ -89,11 +89,7 @@ jasmine.getEnv = function() {
* @returns {Boolean}
*/
jasmine.isArray_ = function(value) {
return value &&
typeof value === 'object' &&
typeof value.length === 'number' &&
typeof value.splice === 'function' &&
!(value.propertyIsEnumerable('length'));
return Object.prototype.toString.apply(value) === '[object Array]';
};
/**
@@ -350,6 +346,9 @@ jasmine.isSpy = function(putativeSpy) {
* @param {Array} methodNames array of names of methods to make spies
*/
jasmine.createSpyObj = function(baseName, methodNames) {
if (!jasmine.isArray_(methodNames) || methodNames.length == 0) {
throw new Error('createSpyObj requires a non-empty array of method names to create spies for');
}
var obj = {};
for (var i = 0; i < methodNames.length; i++) {
obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]);
@@ -501,10 +500,8 @@ var xdescribe = function(description, specDefinitions) {
};
jasmine.XmlHttpRequest = XMLHttpRequest;
// Provide the XMLHttpRequest class for IE 5.x-6.x:
if (typeof XMLHttpRequest == "undefined") jasmine.XmlHttpRequest = function() {
jasmine.XmlHttpRequest = (typeof XMLHttpRequest == "undefined") ? function() {
try {
return new ActiveXObject("Msxml2.XMLHTTP.6.0");
} catch(e) {
@@ -522,7 +519,7 @@ if (typeof XMLHttpRequest == "undefined") jasmine.XmlHttpRequest = function() {
} catch(e) {
}
throw new Error("This browser does not support XMLHttpRequest.");
};
} : XMLHttpRequest;
/**
* Adds suite files to an HTML document so that they are executed, thus adding them to the current

View File

@@ -1,5 +1,5 @@
{
"major": 0,
"minor": 10,
"build": 0
"build": 1
}