vendor/assets/javascripts/chai.js in konacha-1.1.2 vs vendor/assets/javascripts/chai.js in konacha-1.1.3

- old
+ new

@@ -632,17 +632,17 @@ * var Tea = function (name) { this.name = name; } * , Chai = new Tea('chai'); * * expect(Chai).to.be.an.instanceOf(Tea); * - * @name instanceof + * @name instanceOf * @param {Constructor} * @alias instanceOf * @api public */ -Assertion.prototype.instanceof = function (constructor) { +Assertion.prototype.instanceOf = function (constructor) { var name = constructor.name; this.assert( this.obj instanceof constructor , 'expected ' + this.inspect + ' to be an instance of ' + name , 'expected ' + this.inspect + ' to not be an instance of ' + name); @@ -919,11 +919,11 @@ * @param {ErrorConstructor} constructor * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types * @api public */ -Assertion.prototype.throw = function (constructor, msg) { +Assertion.prototype.Throw = function (constructor, msg) { new Assertion(this.obj).is.a('function'); var thrown = false; if (arguments.length === 0) { @@ -1061,13 +1061,13 @@ ('length', 'lengthOf') ('keys', 'key') ('ownProperty', 'haveOwnProperty') ('above', 'greaterThan') ('below', 'lessThan') -('throw', 'throws') -('throw', 'Throw') // for troublesome browsers -('instanceof', 'instanceOf'); +('Throw', 'throws') +('Throw', 'throw') // for troublesome browsers +('instanceOf', 'instanceof'); }); // module: assertion.js require.register("chai.js", function(module, exports, require){ /*! @@ -1077,11 +1077,11 @@ */ var used = []; var exports = module.exports = {}; -exports.version = '0.5.2'; +exports.version = '0.5.3'; exports.Assertion = require('./assertion'); exports.AssertionError = require('./error'); exports.inspect = require('./utils/inspect'); @@ -1111,12 +1111,10 @@ * chai * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com> * MIT Licensed */ -var fail = require('./chai').fail; - module.exports = AssertionError; /*! * Inspired by node.js assert module * https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/assert.js @@ -1126,14 +1124,13 @@ this.name = 'AssertionError'; this.message = options.message; this.actual = options.actual; this.expected = options.expected; this.operator = options.operator; - var stackStartFunction = options.stackStartFunction || fail; if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); + Error.captureStackTrace(this, options.stackStartFunction); } } AssertionError.prototype.__proto__ = Error.prototype; @@ -1246,11 +1243,14 @@ var test = new Assertion(act, msg); test.assert( exp == test.obj , 'expected ' + test.inspect + ' to equal ' + inspect(exp) - , 'expected ' + test.inspect + ' to not equal ' + inspect(exp)); + , 'expected ' + test.inspect + ' to not equal ' + inspect(exp) + , exp + , act + ); }; /** * # .notEqual(actual, expected, [message]) * @@ -1269,11 +1269,14 @@ var test = new Assertion(act, msg); test.assert( exp != test.obj , 'expected ' + test.inspect + ' to equal ' + inspect(exp) - , 'expected ' + test.inspect + ' to not equal ' + inspect(exp)); + , 'expected ' + test.inspect + ' to not equal ' + inspect(exp) + , exp + , act + ); }; /** * # .strictEqual(actual, expected, [message]) * @@ -1359,11 +1362,11 @@ * @param {String} message * @api public */ assert.isTrue = function (val, msg) { - new Assertion(val, msg).is.true; + new Assertion(val, msg).is['true']; }; /** * # .isFalse(value, [message]) * @@ -1377,11 +1380,11 @@ * @param {String} message * @api public */ assert.isFalse = function (val, msg) { - new Assertion(val, msg).is.false; + new Assertion(val, msg).is['false']; }; /** * # .isNull(value, [message]) * @@ -1501,11 +1504,11 @@ * @param {String} message * @api public */ assert.isArray = function (val, msg) { - new Assertion(val, msg).to.be.instanceof(Array); + new Assertion(val, msg).to.be.instanceOf(Array); }; /** * # .isString(value, [message]) * @@ -1597,11 +1600,11 @@ * @param {String} message * @api public */ assert.instanceOf = function (val, type, msg) { - new Assertion(val, msg).to.be.instanceof(type); + new Assertion(val, msg).to.be.instanceOf(type); }; /** * # .include(value, includes, [message]) * @@ -1686,11 +1689,11 @@ if ('string' === typeof type) { msg = type; type = null; } - new Assertion(fn, msg).to.throw(type); + new Assertion(fn, msg).to.Throw(type); }; /** * # .doesNotThrow(function, [constructor/regexp], [message]) * @@ -1712,11 +1715,11 @@ if ('string' === typeof type) { msg = type; type = null; } - new Assertion(fn, msg).to.not.throw(type); + new Assertion(fn, msg).to.not.Throw(type); }; /** * # .operator(val, operator, val2, [message]) * @@ -1811,12 +1814,12 @@ should.equal = function (val1, val2) { new Assertion(val1).to.equal(val2); }; - should.throw = function (fn, errt, errs) { - new Assertion(fn).to.throw(errt, errs); + should.Throw = function (fn, errt, errs) { + new Assertion(fn).to.Throw(errt, errs); }; should.exist = function (val) { new Assertion(val).to.exist; } @@ -1826,16 +1829,19 @@ should.not.equal = function (val1, val2) { new Assertion(val1).to.not.equal(val2); }; - should.not.throw = function (fn, errt, errs) { - new Assertion(fn).to.not.throw(errt, errs); + should.not.Throw = function (fn, errt, errs) { + new Assertion(fn).to.not.Throw(errt, errs); }; should.not.exist = function (val) { new Assertion(val).to.not.exist; } + + should['throw'] = should['Throw']; + should.not['throw'] = should.not['Throw']; return should; }; }; \ No newline at end of file