smparkes-jazrb 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/README.rdoc +2 -0
  2. data/bin/jazrb +6 -0
  3. data/doc/jasmine/files.html +1 -1
  4. data/doc/jasmine/index.html +1 -1
  5. data/doc/jasmine/symbols/_global_.html +38 -1
  6. data/doc/jasmine/symbols/jasmine.Block.html +1 -1
  7. data/doc/jasmine/symbols/jasmine.Clock.html +1 -1
  8. data/doc/jasmine/symbols/jasmine.Env.html +38 -4
  9. data/doc/jasmine/symbols/jasmine.JsApiReporter.html +1 -1
  10. data/doc/jasmine/symbols/jasmine.Matchers.html +472 -191
  11. data/doc/jasmine/symbols/jasmine.MultiReporter.html +1 -1
  12. data/doc/jasmine/symbols/jasmine.NestedResults.html +1 -1
  13. data/doc/jasmine/symbols/jasmine.Reporter.html +1 -1
  14. data/doc/jasmine/symbols/jasmine.Runner.html +1 -1
  15. data/doc/jasmine/symbols/jasmine.Spec.html +1 -1
  16. data/doc/jasmine/symbols/jasmine.Spy.html +1 -1
  17. data/doc/jasmine/symbols/jasmine.Suite.html +1 -1
  18. data/doc/jasmine/symbols/jasmine.html +87 -1
  19. data/doc/jasmine/symbols/jasmine.util.html +1 -1
  20. data/doc/jasmine/symbols/src/lib_TrivialReporter.js.html +27 -29
  21. data/doc/jasmine/symbols/src/src_Block.js.html +12 -6
  22. data/doc/jasmine/symbols/src/src_Env.js.html +202 -190
  23. data/doc/jasmine/symbols/src/src_JsApiReporter.js.html +23 -22
  24. data/doc/jasmine/symbols/src/src_Matchers.js.html +253 -347
  25. data/doc/jasmine/symbols/src/src_PrettyPrinter.js.html +106 -104
  26. data/doc/jasmine/symbols/src/src_Spec.js.html +208 -209
  27. data/doc/jasmine/symbols/src/src_base.js.html +233 -214
  28. data/lib/jazrb/jasmine/TrivialReporter.js +1 -3
  29. data/lib/jazrb/jasmine/XMLReporter.js +8 -3
  30. data/lib/jazrb/jasmine/jasmine-0.10.0.js +174 -229
  31. data/lib/jazrb/jasmine/jasmine.js +174 -229
  32. metadata +2 -2
@@ -89,9 +89,7 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
89
89
  for (var i = 0; i < resultItems.length; i++) {
90
90
  var result = resultItems[i];
91
91
  if (result.passed && !result.passed()) {
92
- var resultMessageDiv = this.createDom('div', {className: 'resultMessage fail'});
93
- resultMessageDiv.innerHTML = result.message; // todo: lame; mend
94
- specDiv.appendChild(resultMessageDiv);
92
+ specDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
95
93
  specDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
96
94
  }
97
95
  }
@@ -137,7 +137,11 @@ jasmine.XMLReporter.prototype.reportSpecResults = function(spec) {
137
137
  name.unshift( suite.description );
138
138
  suite = suite.parentSuite;
139
139
  }
140
- puts(" <testsuite"+formatAttributes({name:name.join(" : ")}) +">");
140
+ var attrs = {name:name.join(" : ")};
141
+ if(spec.pending) {
142
+ attrs.skipped = "true";
143
+ }
144
+ puts(" <testsuite"+formatAttributes(attrs) +">");
141
145
  jasmine.XMLReporter.current_spec = spec;
142
146
  this.results_[spec.id] = {
143
147
  spec: spec,
@@ -147,8 +151,9 @@ jasmine.XMLReporter.prototype.reportSpecResults = function(spec) {
147
151
  var results = spec.results().getItems();
148
152
  for(var i in results) {
149
153
  var result = results[i];
150
- puts(" <testcase"+formatAttributes({name:(1+parseInt(i))+ ": " + result.matcherName})+">");
151
- if(!result.passed()){
154
+ var attrs = {name:(1+parseInt(i))+ ": " + result.matcherName};
155
+ puts(" <testcase"+formatAttributes(attrs)+">");
156
+ if(!result.passed() && !attrs.skipped){
152
157
  puts(" <failure"+formatAttributes({type:result.matcherName,
153
158
  message:result.message})+">");
154
159
  puts("<![CDATA[");
@@ -19,7 +19,7 @@ jasmine.unimplementedMethod_ = function() {
19
19
  jasmine.DEFAULT_UPDATE_INTERVAL = 250;
20
20
 
21
21
  /**
22
- * Allows for bound functions to be comapred. Internal use only.
22
+ * Allows for bound functions to be compared. Internal use only.
23
23
  *
24
24
  * @ignore
25
25
  * @private
@@ -325,6 +325,16 @@ jasmine.createSpy = function(name) {
325
325
  return spyObj;
326
326
  };
327
327
 
328
+ /**
329
+ * Determines whether an object is a spy.
330
+ *
331
+ * @param {jasmine.Spy|Object} putativeSpy
332
+ * @returns {Boolean}
333
+ */
334
+ jasmine.isSpy = function(putativeSpy) {
335
+ return putativeSpy && putativeSpy.isSpy;
336
+ };
337
+
328
338
  /**
329
339
  * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something
330
340
  * large in one call.
@@ -392,6 +402,15 @@ var xit = function(desc, func) {
392
402
  return jasmine.getEnv().xit(desc, func);
393
403
  };
394
404
 
405
+ jasmine.pending_ = function(){
406
+ Error.call(this,"Pending");
407
+ };
408
+ jasmine.pending_.prototype = new Error;
409
+
410
+ var pending = function() {
411
+ throw new jasmine.pending_;
412
+ };
413
+
395
414
  /**
396
415
  * Starts a chain for a Jasmine expectation.
397
416
  *
@@ -552,7 +571,7 @@ jasmine.version_= {
552
571
  "major": 0,
553
572
  "minor": 10,
554
573
  "build": 0,
555
- "revision": 1258603168
574
+ "revision": 1259177226
556
575
  };
557
576
  /**
558
577
  * @namespace
@@ -633,7 +652,7 @@ jasmine.Env = function() {
633
652
 
634
653
  this.reporter = new jasmine.MultiReporter();
635
654
 
636
- this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL
655
+ this.updateInterval = jasmine.DEFAULT_UPDATE_INTERVAL;
637
656
  this.lastUpdate = 0;
638
657
  this.specFilter = function() {
639
658
  return true;
@@ -642,6 +661,17 @@ jasmine.Env = function() {
642
661
  this.nextSpecId_ = 0;
643
662
  this.nextSuiteId_ = 0;
644
663
  this.equalityTesters_ = [];
664
+
665
+ // wrap matchers
666
+ this.matchersClass = function() {
667
+ jasmine.Matchers.apply(this, arguments);
668
+ };
669
+ jasmine.util.inherit(this.matchersClass, jasmine.Matchers);
670
+
671
+ for (var methodName in jasmine.Matchers.prototype) {
672
+ var orig = jasmine.Matchers.prototype[methodName];
673
+ this.matchersClass.prototype[methodName] = jasmine.Matchers.matcherFn_(methodName, orig);
674
+ }
645
675
  };
646
676
 
647
677
 
@@ -738,20 +768,21 @@ jasmine.Env.prototype.it = function(description, func) {
738
768
  var spec = new jasmine.Spec(this, this.currentSuite, description);
739
769
  this.currentSuite.add(spec);
740
770
  this.currentSpec = spec;
771
+ spec.pending = false;
741
772
 
742
773
  if (func) {
743
774
  spec.runs(func);
775
+ } else {
776
+ spec.pending = true;
744
777
  }
745
778
 
746
779
  return spec;
747
780
  };
748
781
 
749
- jasmine.Env.prototype.xit = function(desc, func) {
750
- return {
751
- id: this.nextSpecId(),
752
- runs: function() {
753
- }
754
- };
782
+ jasmine.Env.prototype.xit = function(description, func) {
783
+ var spec = this.it(description, func);
784
+ spec.pending = -1;
785
+ return spec;
755
786
  };
756
787
 
757
788
  jasmine.Env.prototype.compareObjects_ = function(a, b, mismatchKeys, mismatchValues) {
@@ -888,9 +919,15 @@ jasmine.Block = function(env, func, spec) {
888
919
 
889
920
  jasmine.Block.prototype.execute = function(onComplete) {
890
921
  try {
891
- this.func.apply(this.spec);
922
+ if(!this.spec.pending){
923
+ this.func.apply(this.spec);
924
+ }
892
925
  } catch (e) {
893
- this.spec.fail(e);
926
+ if(e instanceof jasmine.pending_){
927
+ this.spec.pending = true;
928
+ } else {
929
+ this.spec && this.spec.fail(e);
930
+ }
894
931
  }
895
932
  onComplete();
896
933
  };
@@ -975,7 +1012,8 @@ jasmine.JsApiReporter.prototype.resultsForSpecs = function(specIds){
975
1012
 
976
1013
  jasmine.JsApiReporter.prototype.summarizeResult_ = function(result){
977
1014
  var summaryMessages = [];
978
- for (var messageIndex in result.messages) {
1015
+ var messagesLength = result.messages.length
1016
+ for (var messageIndex = 0; messageIndex < messagesLength; messageIndex++) {
979
1017
  var resultMessage = result.messages[messageIndex];
980
1018
  summaryMessages.push({
981
1019
  text: resultMessage.text,
@@ -1022,15 +1060,25 @@ jasmine.Matchers.prototype.report = function(result, failing_message, details) {
1022
1060
  return result;
1023
1061
  };
1024
1062
 
1025
- jasmine.Matchers.matcherFn_ = function(matcherName, options) {
1026
- return function () {
1027
- jasmine.util.extend(this, options);
1063
+ jasmine.Matchers.matcherFn_ = function(matcherName, matcherFunction) {
1064
+ return function() {
1028
1065
  var matcherArgs = jasmine.util.argsToArray(arguments);
1029
- var args = [this.actual].concat(matcherArgs);
1030
- var result = options.test.apply(this, args);
1066
+ var result = matcherFunction.apply(this, arguments);
1031
1067
  var message;
1032
1068
  if (!result) {
1033
- message = options.message.apply(this, args);
1069
+ if (this.message) {
1070
+ message = this.message.apply(this, arguments);
1071
+ } else {
1072
+ var englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { return ' ' + s.toLowerCase(); });
1073
+ message = "Expected " + jasmine.pp(this.actual) + " " + englishyPredicate;
1074
+ if (matcherArgs.length > 0) {
1075
+ for (var i = 0; i < matcherArgs.length; i++) {
1076
+ if (i > 0) message += ",";
1077
+ message += " " + jasmine.pp(matcherArgs[i]);
1078
+ }
1079
+ }
1080
+ message += ".";
1081
+ }
1034
1082
  }
1035
1083
  var expectationResult = new jasmine.ExpectationResult({
1036
1084
  matcherName: matcherName,
@@ -1052,27 +1100,17 @@ jasmine.Matchers.matcherFn_ = function(matcherName, options) {
1052
1100
  * @param expected
1053
1101
  */
1054
1102
 
1055
- jasmine.Matchers.prototype.toBe = jasmine.Matchers.matcherFn_('toBe', {
1056
- test: function (actual, expected) {
1057
- return actual === expected;
1058
- },
1059
- message: function(actual, expected) {
1060
- return "Expected " + jasmine.pp(actual) + " to be " + jasmine.pp(expected);
1061
- }
1062
- });
1103
+ jasmine.Matchers.prototype.toBe = function(expected) {
1104
+ return this.actual === expected;
1105
+ };
1063
1106
 
1064
1107
  /**
1065
1108
  * toNotBe: compares the actual to the expected using !==
1066
1109
  * @param expected
1067
1110
  */
1068
- jasmine.Matchers.prototype.toNotBe = jasmine.Matchers.matcherFn_('toNotBe', {
1069
- test: function (actual, expected) {
1070
- return actual !== expected;
1071
- },
1072
- message: function(actual, expected) {
1073
- return "Expected " + jasmine.pp(actual) + " to not be " + jasmine.pp(expected);
1074
- }
1075
- });
1111
+ jasmine.Matchers.prototype.toNotBe = function(expected) {
1112
+ return this.actual !== expected;
1113
+ };
1076
1114
 
1077
1115
  /**
1078
1116
  * toEqual: compares the actual to the expected using common sense equality. Handles Objects, Arrays, etc.
@@ -1080,27 +1118,17 @@ jasmine.Matchers.prototype.toNotBe = jasmine.Matchers.matcherFn_('toNotBe', {
1080
1118
  * @param expected
1081
1119
  */
1082
1120
 
1083
- jasmine.Matchers.prototype.toEqual = jasmine.Matchers.matcherFn_('toEqual', {
1084
- test: function (actual, expected) {
1085
- return this.env.equals_(actual, expected);
1086
- },
1087
- message: function(actual, expected) {
1088
- return "Expected " + jasmine.pp(actual) + " to equal " + jasmine.pp(expected);
1089
- }
1090
- });
1121
+ jasmine.Matchers.prototype.toEqual = function(expected) {
1122
+ return this.env.equals_(this.actual, expected);
1123
+ };
1091
1124
 
1092
1125
  /**
1093
1126
  * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
1094
1127
  * @param expected
1095
1128
  */
1096
- jasmine.Matchers.prototype.toNotEqual = jasmine.Matchers.matcherFn_('toNotEqual', {
1097
- test: function (actual, expected) {
1098
- return !this.env.equals_(actual, expected);
1099
- },
1100
- message: function(actual, expected) {
1101
- return "Expected " + jasmine.pp(actual) + " to not equal " + jasmine.pp(expected);
1102
- }
1103
- });
1129
+ jasmine.Matchers.prototype.toNotEqual = function(expected) {
1130
+ return !this.env.equals_(this.actual, expected);
1131
+ };
1104
1132
 
1105
1133
  /**
1106
1134
  * Matcher that compares the actual to the expected using a regular expression. Constructs a RegExp, so takes
@@ -1108,228 +1136,143 @@ jasmine.Matchers.prototype.toNotEqual = jasmine.Matchers.matcherFn_('toNotEqual'
1108
1136
  *
1109
1137
  * @param reg_exp
1110
1138
  */
1111
- jasmine.Matchers.prototype.toMatch = jasmine.Matchers.matcherFn_('toMatch', {
1112
- test: function(actual, expected) {
1113
- return new RegExp(expected).test(actual);
1114
- },
1115
- message: function(actual, expected) {
1116
- return jasmine.pp(actual) + " does not match the regular expression " + new RegExp(expected).toString();
1117
- }
1118
- });
1139
+ jasmine.Matchers.prototype.toMatch = function(expected) {
1140
+ return new RegExp(expected).test(this.actual);
1141
+ };
1119
1142
 
1120
1143
  /**
1121
1144
  * Matcher that compares the actual to the expected using the boolean inverse of jasmine.Matchers.toMatch
1122
1145
  * @param reg_exp
1123
1146
  */
1124
-
1125
- jasmine.Matchers.prototype.toNotMatch = jasmine.Matchers.matcherFn_('toNotMatch', {
1126
- test: function(actual, expected) {
1127
- return !(new RegExp(expected).test(actual));
1128
- },
1129
- message: function(actual, expected) {
1130
- return jasmine.pp(actual) + " should not match " + new RegExp(expected).toString();
1131
- }
1132
- });
1147
+ jasmine.Matchers.prototype.toNotMatch = function(expected) {
1148
+ return !(new RegExp(expected).test(this.actual));
1149
+ };
1133
1150
 
1134
1151
  /**
1135
- * Matcher that compares the acutal to undefined.
1152
+ * Matcher that compares the actual to undefined.
1136
1153
  */
1137
-
1138
- jasmine.Matchers.prototype.toBeDefined = jasmine.Matchers.matcherFn_('toBeDefined', {
1139
- test: function(actual) {
1140
- return (actual !== undefined);
1141
- },
1142
- message: function() {
1143
- return 'Expected actual to not be undefined.';
1144
- }
1145
- });
1154
+ jasmine.Matchers.prototype.toBeDefined = function() {
1155
+ return (this.actual !== undefined);
1156
+ };
1146
1157
 
1147
1158
  /**
1148
- * Matcher that compares the acutal to undefined.
1159
+ * Matcher that compares the actual to undefined.
1149
1160
  */
1150
-
1151
- jasmine.Matchers.prototype.toBeUndefined = jasmine.Matchers.matcherFn_('toBeUndefined', {
1152
- test: function(actual) {
1153
- return (actual === undefined);
1154
- },
1155
- message: function(actual) {
1156
- return 'Expected ' + jasmine.pp(actual) + ' to be undefined.';
1157
- }
1158
- });
1161
+ jasmine.Matchers.prototype.toBeUndefined = function() {
1162
+ return (this.actual === undefined);
1163
+ };
1159
1164
 
1160
1165
  /**
1161
1166
  * Matcher that compares the actual to null.
1162
- *
1163
1167
  */
1164
- jasmine.Matchers.prototype.toBeNull = jasmine.Matchers.matcherFn_('toBeNull', {
1165
- test: function(actual) {
1166
- return (actual === null);
1167
- },
1168
- message: function(actual) {
1169
- return 'Expected ' + jasmine.pp(actual) + ' to be null.';
1170
- }
1171
- });
1168
+ jasmine.Matchers.prototype.toBeNull = function() {
1169
+ return (this.actual === null);
1170
+ };
1172
1171
 
1173
1172
  /**
1174
1173
  * Matcher that boolean not-nots the actual.
1175
1174
  */
1176
- jasmine.Matchers.prototype.toBeTruthy = jasmine.Matchers.matcherFn_('toBeTruthy', {
1177
- test: function(actual) {
1178
- return !!actual;
1179
- },
1180
- message: function() {
1181
- return 'Expected actual to be truthy';
1182
- }
1183
- });
1175
+ jasmine.Matchers.prototype.toBeTruthy = function() {
1176
+ return !!this.actual;
1177
+ };
1184
1178
 
1185
1179
 
1186
1180
  /**
1187
1181
  * Matcher that boolean nots the actual.
1188
1182
  */
1189
- jasmine.Matchers.prototype.toBeFalsy = jasmine.Matchers.matcherFn_('toBeFalsy', {
1190
- test: function(actual) {
1191
- return !actual;
1192
- },
1193
- message: function(actual) {
1194
- return 'Expected ' + jasmine.pp(actual) + ' to be falsy';
1195
- }
1196
- });
1183
+ jasmine.Matchers.prototype.toBeFalsy = function() {
1184
+ return !this.actual;
1185
+ };
1197
1186
 
1198
1187
  /**
1199
- * Matcher that checks to see if the acutal, a Jasmine spy, was called.
1188
+ * Matcher that checks to see if the actual, a Jasmine spy, was called.
1200
1189
  */
1190
+ jasmine.Matchers.prototype.wasCalled = function() {
1191
+ if (arguments.length > 0) {
1192
+ throw new Error('wasCalled does not take arguments, use wasCalledWith');
1193
+ }
1201
1194
 
1202
- jasmine.Matchers.prototype.wasCalled = jasmine.Matchers.matcherFn_('wasCalled', {
1203
- getActual_: function() {
1204
- var args = jasmine.util.argsToArray(arguments);
1205
- if (args.length > 1) {
1206
- throw(new Error('wasCalled does not take arguments, use wasCalledWith'));
1207
- }
1208
- return args.splice(0, 1)[0];
1209
- },
1210
- test: function() {
1211
- var actual = this.getActual_.apply(this, arguments);
1212
- if (!actual || !actual.isSpy) {
1213
- return false;
1214
- }
1215
- return actual.wasCalled;
1216
- },
1217
- message: function() {
1218
- var actual = this.getActual_.apply(this, arguments);
1219
- if (!actual || !actual.isSpy) {
1220
- return 'Actual is not a spy.';
1221
- }
1222
- return "Expected spy " + actual.identity + " to have been called.";
1195
+ if (!jasmine.isSpy(this.actual)) {
1196
+ throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
1223
1197
  }
1224
- });
1198
+
1199
+ this.message = function() {
1200
+ return "Expected spy " + this.actual.identity + " to have been called.";
1201
+ };
1202
+
1203
+ return this.actual.wasCalled;
1204
+ };
1225
1205
 
1226
1206
  /**
1227
- * Matcher that checks to see if the acutal, a Jasmine spy, was not called.
1207
+ * Matcher that checks to see if the actual, a Jasmine spy, was not called.
1228
1208
  */
1229
- jasmine.Matchers.prototype.wasNotCalled = jasmine.Matchers.matcherFn_('wasNotCalled', {
1230
- getActual_: function() {
1231
- var args = jasmine.util.argsToArray(arguments);
1232
- return args.splice(0, 1)[0];
1233
- },
1234
- test: function() {
1235
- var actual = this.getActual_.apply(this, arguments);
1236
- if (!actual || !actual.isSpy) {
1237
- return false;
1238
- }
1239
- return !actual.wasCalled;
1240
- },
1241
- message: function() {
1242
- var actual = this.getActual_.apply(this, arguments);
1243
- if (!actual || !actual.isSpy) {
1244
- return 'Actual is not a spy.';
1245
- }
1246
- return "Expected spy " + actual.identity + " to not have been called.";
1209
+ jasmine.Matchers.prototype.wasNotCalled = function() {
1210
+ if (arguments.length > 0) {
1211
+ throw new Error('wasNotCalled does not take arguments');
1247
1212
  }
1248
- });
1249
1213
 
1250
- jasmine.Matchers.prototype.wasCalledWith = jasmine.Matchers.matcherFn_('wasCalledWith', {
1251
- test: function() {
1252
- var args = jasmine.util.argsToArray(arguments);
1253
- var actual = args.splice(0, 1)[0];
1254
- if (!actual || !actual.isSpy) {
1255
- return false;
1256
- }
1257
- return this.env.contains_(actual.argsForCall, args);
1258
- },
1259
- message: function() {
1260
- var args = jasmine.util.argsToArray(arguments);
1261
- var actual = args.splice(0, 1)[0];
1262
- var message;
1263
- if (!actual || !actual.isSpy) {
1264
- message = 'Actual is not a spy';
1265
- } else {
1266
- message = "Expected spy to have been called with " + jasmine.pp(args) + " but was called with " + actual.argsForCall;
1267
- }
1268
- return message;
1214
+ if (!jasmine.isSpy(this.actual)) {
1215
+ throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
1269
1216
  }
1270
- });
1217
+
1218
+ this.message = function() {
1219
+ return "Expected spy " + this.actual.identity + " to not have been called.";
1220
+ };
1221
+
1222
+ return !this.actual.wasCalled;
1223
+ };
1271
1224
 
1272
1225
  /**
1273
- * Matcher that checks to see if the acutal, a Jasmine spy, was called with a set of parameters.
1226
+ * Matcher that checks to see if the actual, a Jasmine spy, was called with a set of parameters.
1274
1227
  *
1275
1228
  * @example
1276
1229
  *
1277
1230
  */
1231
+ jasmine.Matchers.prototype.wasCalledWith = function() {
1232
+ if (!jasmine.isSpy(this.actual)) {
1233
+ throw new Error('Expected a spy, but got ' + jasmine.Matchers.pp(this.actual) + '.');
1234
+ }
1235
+
1236
+ this.message = function() {
1237
+ return "Expected spy to have been called with " + jasmine.pp(arguments) + " but was called with " + jasmine.pp(this.actual.argsForCall);
1238
+ };
1239
+
1240
+ return this.env.contains_(this.actual.argsForCall, jasmine.util.argsToArray(arguments));
1241
+ };
1278
1242
 
1279
1243
  /**
1280
1244
  * Matcher that checks that the expected item is an element in the actual Array.
1281
1245
  *
1282
1246
  * @param {Object} item
1283
1247
  */
1284
-
1285
- jasmine.Matchers.prototype.toContain = jasmine.Matchers.matcherFn_('toContain', {
1286
- test: function(actual, expected) {
1287
- return this.env.contains_(actual, expected);
1288
- },
1289
- message: function(actual, expected) {
1290
- return 'Expected ' + jasmine.pp(actual) + ' to contain ' + jasmine.pp(expected);
1291
- }
1292
- });
1248
+ jasmine.Matchers.prototype.toContain = function(expected) {
1249
+ return this.env.contains_(this.actual, expected);
1250
+ };
1293
1251
 
1294
1252
  /**
1295
1253
  * Matcher that checks that the expected item is NOT an element in the actual Array.
1296
1254
  *
1297
1255
  * @param {Object} item
1298
1256
  */
1299
- jasmine.Matchers.prototype.toNotContain = jasmine.Matchers.matcherFn_('toNotContain', {
1300
- test: function(actual, expected) {
1301
- return !this.env.contains_(actual, expected);
1302
- },
1303
- message: function(actual, expected) {
1304
- return 'Expected ' + jasmine.pp(actual) + ' to not contain ' + jasmine.pp(expected);
1305
- }
1306
- });
1257
+ jasmine.Matchers.prototype.toNotContain = function(expected) {
1258
+ return !this.env.contains_(this.actual, expected);
1259
+ };
1307
1260
 
1308
- jasmine.Matchers.prototype.toBeLessThan = jasmine.Matchers.matcherFn_('toBeLessThan', {
1309
- test: function(actual, expected) {
1310
- return actual < expected;
1311
- },
1312
- message: function(actual, expected) {
1313
- return 'Expected ' + jasmine.pp(actual) + ' to be less than ' + jasmine.pp(expected);
1314
- }
1315
- });
1261
+ jasmine.Matchers.prototype.toBeLessThan = function(expected) {
1262
+ return this.actual < expected;
1263
+ };
1316
1264
 
1317
- jasmine.Matchers.prototype.toBeGreaterThan = jasmine.Matchers.matcherFn_('toBeGreaterThan', {
1318
- test: function(actual, expected) {
1319
- return actual > expected;
1320
- },
1321
- message: function(actual, expected) {
1322
- return 'Expected ' + jasmine.pp(actual) + ' to be greater than ' + jasmine.pp(expected);
1323
- }
1324
- });
1265
+ jasmine.Matchers.prototype.toBeGreaterThan = function(expected) {
1266
+ return this.actual > expected;
1267
+ };
1325
1268
 
1326
1269
  /**
1327
1270
  * Matcher that checks that the expected exception was thrown by the actual.
1328
1271
  *
1329
1272
  * @param {String} expectedException
1330
1273
  */
1331
- jasmine.Matchers.prototype.toThrow = jasmine.Matchers.matcherFn_('toThrow', {
1332
- getException_: function(actual, expected) {
1274
+ jasmine.Matchers.prototype.toThrow = function(expected) {
1275
+ function getException_(actual, expected) {
1333
1276
  var exception;
1334
1277
  if (typeof actual != 'function') {
1335
1278
  throw new Error('Actual is not a function');
@@ -1340,24 +1283,25 @@ jasmine.Matchers.prototype.toThrow = jasmine.Matchers.matcherFn_('toThrow', {
1340
1283
  exception = e;
1341
1284
  }
1342
1285
  return exception;
1343
- },
1344
- test: function(actual, expected) {
1345
- var result = false;
1346
- var exception = this.getException_(actual, expected);
1347
- if (exception) {
1348
- result = (expected === undefined || this.env.equals_(exception.message || exception, expected.message || expected));
1349
- }
1350
- return result;
1351
- },
1352
- message: function(actual, expected) {
1353
- var exception = this.getException_(actual, expected);
1286
+ }
1287
+
1288
+ var result = false;
1289
+ var exception = getException_(this.actual, expected);
1290
+ if (exception) {
1291
+ result = (expected === undefined || this.env.equals_(exception.message || exception, expected.message || expected));
1292
+ }
1293
+
1294
+ this.message = function(expected) {
1295
+ var exception = getException_(this.actual, expected);
1354
1296
  if (exception && (expected === undefined || !this.env.equals_(exception.message || exception, expected.message || expected))) {
1355
1297
  return ["Expected function to throw", expected.message || expected, ", but it threw", exception.message || exception ].join(' ');
1356
1298
  } else {
1357
1299
  return "Expected function to throw an exception.";
1358
1300
  }
1359
- }
1360
- });
1301
+ };
1302
+
1303
+ return result;
1304
+ };
1361
1305
 
1362
1306
  jasmine.Matchers.Any = function(expectedClass) {
1363
1307
  this.expectedClass = expectedClass;
@@ -1506,11 +1450,9 @@ jasmine.PrettyPrinter = function() {
1506
1450
  * Formats a value in a nice, human-readable string.
1507
1451
  *
1508
1452
  * @param value
1509
- * @returns {String}
1510
1453
  */
1511
1454
  jasmine.PrettyPrinter.prototype.format = function(value) {
1512
1455
  if (this.ppNestLevel_ > 40) {
1513
- // return '(jasmine.pp nested too deeply!)';
1514
1456
  throw new Error('jasmine.PrettyPrinter: format() nested too deeply!');
1515
1457
  }
1516
1458
 
@@ -1526,12 +1468,16 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
1526
1468
  this.emitScalar(value.toString());
1527
1469
  } else if (typeof value === 'string') {
1528
1470
  this.emitString(value);
1471
+ } else if (jasmine.isSpy(value)) {
1472
+ this.emitScalar("spy on " + value.identity);
1529
1473
  } else if (typeof value === 'function') {
1530
1474
  this.emitScalar('Function');
1531
1475
  } else if (typeof value.nodeType === 'number') {
1532
1476
  this.emitScalar('HTMLNode');
1533
1477
  } else if (value instanceof Date) {
1534
1478
  this.emitScalar('Date(' + value + ')');
1479
+ } else if (value instanceof RegExp) {
1480
+ this.emitScalar(value.toString());
1535
1481
  } else if (value.__Jasmine_been_here_before__) {
1536
1482
  this.emitScalar('<circular reference: ' + (jasmine.isArray_(value) ? 'Array' : 'Object') + '>');
1537
1483
  } else if (jasmine.isArray_(value) || typeof value == 'object') {
@@ -1849,11 +1795,9 @@ jasmine.Spec = function(env, suite, description) {
1849
1795
  if (!env) {
1850
1796
  throw new Error('jasmine.Env() required');
1851
1797
  }
1852
- ;
1853
1798
  if (!suite) {
1854
1799
  throw new Error('jasmine.Suite() required');
1855
1800
  }
1856
- ;
1857
1801
  var spec = this;
1858
1802
  spec.id = env.nextSpecId ? env.nextSpecId() : null;
1859
1803
  spec.env = env;
@@ -1890,6 +1834,7 @@ jasmine.Spec.prototype.getResults = function() {
1890
1834
  jasmine.Spec.prototype.runs = function (func) {
1891
1835
  var block = new jasmine.Block(this.env, func, this);
1892
1836
  this.addToQueue(block);
1837
+ ( this.pending != -1 ) && ( this.pending = false );
1893
1838
  return this;
1894
1839
  };
1895
1840
 
@@ -1943,7 +1888,7 @@ jasmine.Spec.prototype.fail = function (e) {
1943
1888
  };
1944
1889
 
1945
1890
  jasmine.Spec.prototype.getMatchersClass_ = function() {
1946
- return this.matchersClass || jasmine.Matchers;
1891
+ return this.matchersClass || this.env.matchersClass;
1947
1892
  };
1948
1893
 
1949
1894
  jasmine.Spec.prototype.addMatchers = function(matchersPrototype) {