Restore Matcher prototype methods for IDE joy

This commit is contained in:
ragaskar 2009-10-30 19:29:19 -07:00
parent 4c600311df
commit f9d73761bb
19 changed files with 64 additions and 60 deletions

View File

@ -272,7 +272,7 @@ ul.inheritsList
</div> </div>
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -308,7 +308,7 @@ ul.inheritsList
</div> </div>
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blankt">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -910,7 +910,7 @@ A convenience method that allows existing specs to be disabled temporarily durin
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -341,7 +341,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -509,7 +509,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -318,7 +318,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -341,7 +341,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -318,7 +318,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -702,7 +702,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -318,7 +318,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -329,7 +329,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -341,7 +341,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -847,7 +847,7 @@ expect(foo.bar.callCount).toEqual(0);</pre>
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -347,7 +347,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -762,7 +762,7 @@ Jasmine environment.
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -318,7 +318,7 @@ ul.inheritsList
<!-- ============================== footer ================================= --> <!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both"> <div class="fineprint" style="clear:both">
Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Thu Oct 29 2009 22:18:21 GMT-0700 (PDT) Documentation generated by <a href="http://www.jsdoctoolkit.org/" target="_blank">JsDoc Toolkit</a> 2.1.0 on Fri Oct 30 2009 19:27:04 GMT-0700 (PDT)
</div> </div>
</body> </body>
</html> </html>

View File

@ -543,7 +543,7 @@
<span class='line'>536</span> </span><span class="WHIT"> </span><span class="STRN">"major"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>536</span> </span><span class="WHIT"> </span><span class="STRN">"major"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>537</span> </span><span class="WHIT"> </span><span class="STRN">"minor"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>537</span> </span><span class="WHIT"> </span><span class="STRN">"minor"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>538</span> </span><span class="WHIT"> </span><span class="STRN">"build"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>538</span> </span><span class="WHIT"> </span><span class="STRN">"build"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>539</span> </span><span class="WHIT"> </span><span class="STRN">"revision"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">1256874141</span><span class="WHIT"> <span class='line'>539</span> </span><span class="WHIT"> </span><span class="STRN">"revision"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">1256879901</span><span class="WHIT">
<span class='line'>540</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>540</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>541</span> </span><span class="COMM">/** <span class='line'>541</span> </span><span class="COMM">/**
<span class='line'>542</span> * @namespace <span class='line'>542</span> * @namespace

View File

@ -536,7 +536,7 @@ jasmine.version_= {
"major": 0, "major": 0,
"minor": 10, "minor": 10,
"build": 0, "build": 0,
"revision": 1256879901 "revision": 1256956024
}; };
/** /**
* @namespace * @namespace
@ -1003,8 +1003,8 @@ jasmine.Matchers.prototype.report = function(result, failing_message, details) {
return result; return result;
}; };
jasmine.Matchers.addMatcher = function(matcherName, options) { jasmine.Matchers.matcherFn_ = function(matcherName, options) {
jasmine.Matchers.prototype[matcherName] = function () { return function () {
jasmine.util.extend(this, options); jasmine.util.extend(this, options);
var matcherArgs = jasmine.util.argsToArray(arguments); var matcherArgs = jasmine.util.argsToArray(arguments);
var args = [this.actual].concat(matcherArgs); var args = [this.actual].concat(matcherArgs);
@ -1026,12 +1026,14 @@ jasmine.Matchers.addMatcher = function(matcherName, options) {
}; };
/** /**
* toBe: compares the actual to the expected using === * toBe: compares the actual to the expected using ===
* @param expected * @param expected
*/ */
jasmine.Matchers.addMatcher('toBe', { jasmine.Matchers.prototype.toBe = jasmine.Matchers.matcherFn_('toBe', {
test: function (actual, expected) { test: function (actual, expected) {
return actual === expected; return actual === expected;
}, },
@ -1044,7 +1046,7 @@ jasmine.Matchers.addMatcher('toBe', {
* toNotBe: compares the actual to the expected using !== * toNotBe: compares the actual to the expected using !==
* @param expected * @param expected
*/ */
jasmine.Matchers.addMatcher('toNotBe', { jasmine.Matchers.prototype.toNotBe = jasmine.Matchers.matcherFn_('toNotBe', {
test: function (actual, expected) { test: function (actual, expected) {
return actual !== expected; return actual !== expected;
}, },
@ -1059,7 +1061,7 @@ jasmine.Matchers.addMatcher('toNotBe', {
* @param expected * @param expected
*/ */
jasmine.Matchers.addMatcher('toEqual', { jasmine.Matchers.prototype.toEqual = jasmine.Matchers.matcherFn_('toEqual', {
test: function (actual, expected) { test: function (actual, expected) {
return this.env.equals_(actual, expected); return this.env.equals_(actual, expected);
}, },
@ -1072,7 +1074,7 @@ jasmine.Matchers.addMatcher('toEqual', {
* toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
* @param expected * @param expected
*/ */
jasmine.Matchers.addMatcher('toNotEqual', { jasmine.Matchers.prototype.toNotEqual = jasmine.Matchers.matcherFn_('toNotEqual', {
test: function (actual, expected) { test: function (actual, expected) {
return !this.env.equals_(actual, expected); return !this.env.equals_(actual, expected);
}, },
@ -1087,7 +1089,7 @@ jasmine.Matchers.addMatcher('toNotEqual', {
* *
* @param reg_exp * @param reg_exp
*/ */
jasmine.Matchers.addMatcher('toMatch', { jasmine.Matchers.prototype.toMatch = jasmine.Matchers.matcherFn_('toMatch', {
test: function(actual, expected) { test: function(actual, expected) {
return new RegExp(expected).test(actual); return new RegExp(expected).test(actual);
}, },
@ -1101,7 +1103,7 @@ jasmine.Matchers.addMatcher('toMatch', {
* @param reg_exp * @param reg_exp
*/ */
jasmine.Matchers.addMatcher('toNotMatch', { jasmine.Matchers.prototype.toNotMatch = jasmine.Matchers.matcherFn_('toNotMatch', {
test: function(actual, expected) { test: function(actual, expected) {
return !(new RegExp(expected).test(actual)); return !(new RegExp(expected).test(actual));
}, },
@ -1114,7 +1116,7 @@ jasmine.Matchers.addMatcher('toNotMatch', {
* Matcher that compares the acutal to undefined. * Matcher that compares the acutal to undefined.
*/ */
jasmine.Matchers.addMatcher('toBeDefined', { jasmine.Matchers.prototype.toBeDefined = jasmine.Matchers.matcherFn_('toBeDefined', {
test: function(actual) { test: function(actual) {
return (actual !== undefined); return (actual !== undefined);
}, },
@ -1127,7 +1129,7 @@ jasmine.Matchers.addMatcher('toBeDefined', {
* Matcher that compares the acutal to undefined. * Matcher that compares the acutal to undefined.
*/ */
jasmine.Matchers.addMatcher('toBeUndefined', { jasmine.Matchers.prototype.toBeUndefined = jasmine.Matchers.matcherFn_('toBeUndefined', {
test: function(actual) { test: function(actual) {
return (actual === undefined); return (actual === undefined);
}, },
@ -1140,7 +1142,7 @@ jasmine.Matchers.addMatcher('toBeUndefined', {
* Matcher that compares the actual to null. * Matcher that compares the actual to null.
* *
*/ */
jasmine.Matchers.addMatcher('toBeNull', { jasmine.Matchers.prototype.toBeNull = jasmine.Matchers.matcherFn_('toBeNull', {
test: function(actual) { test: function(actual) {
return (actual === null); return (actual === null);
}, },
@ -1152,7 +1154,7 @@ jasmine.Matchers.addMatcher('toBeNull', {
/** /**
* Matcher that boolean not-nots the actual. * Matcher that boolean not-nots the actual.
*/ */
jasmine.Matchers.addMatcher('toBeTruthy', { jasmine.Matchers.prototype.toBeTruthy = jasmine.Matchers.matcherFn_('toBeTruthy', {
test: function(actual) { test: function(actual) {
return !!actual; return !!actual;
}, },
@ -1165,7 +1167,7 @@ jasmine.Matchers.addMatcher('toBeTruthy', {
/** /**
* Matcher that boolean nots the actual. * Matcher that boolean nots the actual.
*/ */
jasmine.Matchers.addMatcher('toBeFalsy', { jasmine.Matchers.prototype.toBeFalsy = jasmine.Matchers.matcherFn_('toBeFalsy', {
test: function(actual) { test: function(actual) {
return !actual; return !actual;
}, },
@ -1178,7 +1180,7 @@ jasmine.Matchers.addMatcher('toBeFalsy', {
* Matcher that checks to see if the acutal, a Jasmine spy, was called. * Matcher that checks to see if the acutal, a Jasmine spy, was called.
*/ */
jasmine.Matchers.addMatcher('wasCalled', { jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.matcherFn_('wasCalled', {
getActual_: function() { getActual_: function() {
var args = jasmine.util.argsToArray(arguments); var args = jasmine.util.argsToArray(arguments);
if (args.length > 1) { if (args.length > 1) {
@ -1205,7 +1207,7 @@ jasmine.Matchers.addMatcher('wasCalled', {
/** /**
* Matcher that checks to see if the acutal, a Jasmine spy, was not called. * Matcher that checks to see if the acutal, a Jasmine spy, was not called.
*/ */
jasmine.Matchers.addMatcher('wasNotCalled', { jasmine.Matchers.prototype.wasNotCalled = jasmine.Matchers.matcherFn_('wasNotCalled', {
getActual_: function() { getActual_: function() {
var args = jasmine.util.argsToArray(arguments); var args = jasmine.util.argsToArray(arguments);
return args.splice(0, 1)[0]; return args.splice(0, 1)[0];
@ -1226,7 +1228,7 @@ jasmine.Matchers.addMatcher('wasNotCalled', {
} }
}); });
jasmine.Matchers.addMatcher('wasCalledWith', { jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.matcherFn_('wasCalledWith', {
test: function() { test: function() {
var args = jasmine.util.argsToArray(arguments); var args = jasmine.util.argsToArray(arguments);
var actual = args.splice(0, 1)[0]; var actual = args.splice(0, 1)[0];
@ -1261,7 +1263,7 @@ jasmine.Matchers.addMatcher('wasCalledWith', {
* @param {Object} item * @param {Object} item
*/ */
jasmine.Matchers.addMatcher('toContain', { jasmine.Matchers.prototype.toContain = jasmine.Matchers.matcherFn_('toContain', {
test: function(actual, expected) { test: function(actual, expected) {
return this.env.contains_(actual, expected); return this.env.contains_(actual, expected);
}, },
@ -1275,7 +1277,7 @@ jasmine.Matchers.addMatcher('toContain', {
* *
* @param {Object} item * @param {Object} item
*/ */
jasmine.Matchers.addMatcher('toNotContain', { jasmine.Matchers.prototype.toNotContain = jasmine.Matchers.matcherFn_('toNotContain', {
test: function(actual, expected) { test: function(actual, expected) {
return !this.env.contains_(actual, expected); return !this.env.contains_(actual, expected);
}, },
@ -1284,7 +1286,7 @@ jasmine.Matchers.addMatcher('toNotContain', {
} }
}); });
jasmine.Matchers.addMatcher('toBeLessThan', { jasmine.Matchers.prototype.toBeLessThan = jasmine.Matchers.matcherFn_('toBeLessThan', {
test: function(actual, expected) { test: function(actual, expected) {
return actual < expected; return actual < expected;
}, },
@ -1293,7 +1295,7 @@ jasmine.Matchers.addMatcher('toBeLessThan', {
} }
}); });
jasmine.Matchers.addMatcher('toBeGreaterThan', { jasmine.Matchers.prototype.toBeGreaterThan = jasmine.Matchers.matcherFn_('toBeGreaterThan', {
test: function(actual, expected) { test: function(actual, expected) {
return actual > expected; return actual > expected;
}, },
@ -1307,7 +1309,7 @@ jasmine.Matchers.addMatcher('toBeGreaterThan', {
* *
* @param {String} expectedException * @param {String} expectedException
*/ */
jasmine.Matchers.addMatcher('toThrow', { jasmine.Matchers.prototype.toThrow = jasmine.Matchers.matcherFn_('toThrow', {
getException_: function(actual, expected) { getException_: function(actual, expected) {
var exception; var exception;
if (typeof actual != 'function') { if (typeof actual != 'function') {

View File

@ -24,8 +24,8 @@ jasmine.Matchers.prototype.report = function(result, failing_message, details) {
return result; return result;
}; };
jasmine.Matchers.addMatcher = function(matcherName, options) { jasmine.Matchers.matcherFn_ = function(matcherName, options) {
jasmine.Matchers.prototype[matcherName] = function () { return function () {
jasmine.util.extend(this, options); jasmine.util.extend(this, options);
var matcherArgs = jasmine.util.argsToArray(arguments); var matcherArgs = jasmine.util.argsToArray(arguments);
var args = [this.actual].concat(matcherArgs); var args = [this.actual].concat(matcherArgs);
@ -47,12 +47,14 @@ jasmine.Matchers.addMatcher = function(matcherName, options) {
}; };
/** /**
* toBe: compares the actual to the expected using === * toBe: compares the actual to the expected using ===
* @param expected * @param expected
*/ */
jasmine.Matchers.addMatcher('toBe', { jasmine.Matchers.prototype.toBe = jasmine.Matchers.matcherFn_('toBe', {
test: function (actual, expected) { test: function (actual, expected) {
return actual === expected; return actual === expected;
}, },
@ -65,7 +67,7 @@ jasmine.Matchers.addMatcher('toBe', {
* toNotBe: compares the actual to the expected using !== * toNotBe: compares the actual to the expected using !==
* @param expected * @param expected
*/ */
jasmine.Matchers.addMatcher('toNotBe', { jasmine.Matchers.prototype.toNotBe = jasmine.Matchers.matcherFn_('toNotBe', {
test: function (actual, expected) { test: function (actual, expected) {
return actual !== expected; return actual !== expected;
}, },
@ -80,7 +82,7 @@ jasmine.Matchers.addMatcher('toNotBe', {
* @param expected * @param expected
*/ */
jasmine.Matchers.addMatcher('toEqual', { jasmine.Matchers.prototype.toEqual = jasmine.Matchers.matcherFn_('toEqual', {
test: function (actual, expected) { test: function (actual, expected) {
return this.env.equals_(actual, expected); return this.env.equals_(actual, expected);
}, },
@ -93,7 +95,7 @@ jasmine.Matchers.addMatcher('toEqual', {
* toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
* @param expected * @param expected
*/ */
jasmine.Matchers.addMatcher('toNotEqual', { jasmine.Matchers.prototype.toNotEqual = jasmine.Matchers.matcherFn_('toNotEqual', {
test: function (actual, expected) { test: function (actual, expected) {
return !this.env.equals_(actual, expected); return !this.env.equals_(actual, expected);
}, },
@ -108,7 +110,7 @@ jasmine.Matchers.addMatcher('toNotEqual', {
* *
* @param reg_exp * @param reg_exp
*/ */
jasmine.Matchers.addMatcher('toMatch', { jasmine.Matchers.prototype.toMatch = jasmine.Matchers.matcherFn_('toMatch', {
test: function(actual, expected) { test: function(actual, expected) {
return new RegExp(expected).test(actual); return new RegExp(expected).test(actual);
}, },
@ -122,7 +124,7 @@ jasmine.Matchers.addMatcher('toMatch', {
* @param reg_exp * @param reg_exp
*/ */
jasmine.Matchers.addMatcher('toNotMatch', { jasmine.Matchers.prototype.toNotMatch = jasmine.Matchers.matcherFn_('toNotMatch', {
test: function(actual, expected) { test: function(actual, expected) {
return !(new RegExp(expected).test(actual)); return !(new RegExp(expected).test(actual));
}, },
@ -135,7 +137,7 @@ jasmine.Matchers.addMatcher('toNotMatch', {
* Matcher that compares the acutal to undefined. * Matcher that compares the acutal to undefined.
*/ */
jasmine.Matchers.addMatcher('toBeDefined', { jasmine.Matchers.prototype.toBeDefined = jasmine.Matchers.matcherFn_('toBeDefined', {
test: function(actual) { test: function(actual) {
return (actual !== undefined); return (actual !== undefined);
}, },
@ -148,7 +150,7 @@ jasmine.Matchers.addMatcher('toBeDefined', {
* Matcher that compares the acutal to undefined. * Matcher that compares the acutal to undefined.
*/ */
jasmine.Matchers.addMatcher('toBeUndefined', { jasmine.Matchers.prototype.toBeUndefined = jasmine.Matchers.matcherFn_('toBeUndefined', {
test: function(actual) { test: function(actual) {
return (actual === undefined); return (actual === undefined);
}, },
@ -161,7 +163,7 @@ jasmine.Matchers.addMatcher('toBeUndefined', {
* Matcher that compares the actual to null. * Matcher that compares the actual to null.
* *
*/ */
jasmine.Matchers.addMatcher('toBeNull', { jasmine.Matchers.prototype.toBeNull = jasmine.Matchers.matcherFn_('toBeNull', {
test: function(actual) { test: function(actual) {
return (actual === null); return (actual === null);
}, },
@ -173,7 +175,7 @@ jasmine.Matchers.addMatcher('toBeNull', {
/** /**
* Matcher that boolean not-nots the actual. * Matcher that boolean not-nots the actual.
*/ */
jasmine.Matchers.addMatcher('toBeTruthy', { jasmine.Matchers.prototype.toBeTruthy = jasmine.Matchers.matcherFn_('toBeTruthy', {
test: function(actual) { test: function(actual) {
return !!actual; return !!actual;
}, },
@ -186,7 +188,7 @@ jasmine.Matchers.addMatcher('toBeTruthy', {
/** /**
* Matcher that boolean nots the actual. * Matcher that boolean nots the actual.
*/ */
jasmine.Matchers.addMatcher('toBeFalsy', { jasmine.Matchers.prototype.toBeFalsy = jasmine.Matchers.matcherFn_('toBeFalsy', {
test: function(actual) { test: function(actual) {
return !actual; return !actual;
}, },
@ -199,7 +201,7 @@ jasmine.Matchers.addMatcher('toBeFalsy', {
* Matcher that checks to see if the acutal, a Jasmine spy, was called. * Matcher that checks to see if the acutal, a Jasmine spy, was called.
*/ */
jasmine.Matchers.addMatcher('wasCalled', { jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.matcherFn_('wasCalled', {
getActual_: function() { getActual_: function() {
var args = jasmine.util.argsToArray(arguments); var args = jasmine.util.argsToArray(arguments);
if (args.length > 1) { if (args.length > 1) {
@ -226,7 +228,7 @@ jasmine.Matchers.addMatcher('wasCalled', {
/** /**
* Matcher that checks to see if the acutal, a Jasmine spy, was not called. * Matcher that checks to see if the acutal, a Jasmine spy, was not called.
*/ */
jasmine.Matchers.addMatcher('wasNotCalled', { jasmine.Matchers.prototype.wasNotCalled = jasmine.Matchers.matcherFn_('wasNotCalled', {
getActual_: function() { getActual_: function() {
var args = jasmine.util.argsToArray(arguments); var args = jasmine.util.argsToArray(arguments);
return args.splice(0, 1)[0]; return args.splice(0, 1)[0];
@ -247,7 +249,7 @@ jasmine.Matchers.addMatcher('wasNotCalled', {
} }
}); });
jasmine.Matchers.addMatcher('wasCalledWith', { jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.matcherFn_('wasCalledWith', {
test: function() { test: function() {
var args = jasmine.util.argsToArray(arguments); var args = jasmine.util.argsToArray(arguments);
var actual = args.splice(0, 1)[0]; var actual = args.splice(0, 1)[0];
@ -282,7 +284,7 @@ jasmine.Matchers.addMatcher('wasCalledWith', {
* @param {Object} item * @param {Object} item
*/ */
jasmine.Matchers.addMatcher('toContain', { jasmine.Matchers.prototype.toContain = jasmine.Matchers.matcherFn_('toContain', {
test: function(actual, expected) { test: function(actual, expected) {
return this.env.contains_(actual, expected); return this.env.contains_(actual, expected);
}, },
@ -296,7 +298,7 @@ jasmine.Matchers.addMatcher('toContain', {
* *
* @param {Object} item * @param {Object} item
*/ */
jasmine.Matchers.addMatcher('toNotContain', { jasmine.Matchers.prototype.toNotContain = jasmine.Matchers.matcherFn_('toNotContain', {
test: function(actual, expected) { test: function(actual, expected) {
return !this.env.contains_(actual, expected); return !this.env.contains_(actual, expected);
}, },
@ -305,7 +307,7 @@ jasmine.Matchers.addMatcher('toNotContain', {
} }
}); });
jasmine.Matchers.addMatcher('toBeLessThan', { jasmine.Matchers.prototype.toBeLessThan = jasmine.Matchers.matcherFn_('toBeLessThan', {
test: function(actual, expected) { test: function(actual, expected) {
return actual < expected; return actual < expected;
}, },
@ -314,7 +316,7 @@ jasmine.Matchers.addMatcher('toBeLessThan', {
} }
}); });
jasmine.Matchers.addMatcher('toBeGreaterThan', { jasmine.Matchers.prototype.toBeGreaterThan = jasmine.Matchers.matcherFn_('toBeGreaterThan', {
test: function(actual, expected) { test: function(actual, expected) {
return actual > expected; return actual > expected;
}, },
@ -328,7 +330,7 @@ jasmine.Matchers.addMatcher('toBeGreaterThan', {
* *
* @param {String} expectedException * @param {String} expectedException
*/ */
jasmine.Matchers.addMatcher('toThrow', { jasmine.Matchers.prototype.toThrow = jasmine.Matchers.matcherFn_('toThrow', {
getException_: function(actual, expected) { getException_: function(actual, expected) {
var exception; var exception;
if (typeof actual != 'function') { if (typeof actual != 'function') {