jasmine 1.0.2.0 → 1.0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/HOW_TO_TEST.markdown +4 -6
  2. data/generators/jasmine/templates/lib/tasks/jasmine.rake +8 -2
  3. data/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml +1 -1
  4. data/jasmine.gemspec +4 -5
  5. data/jasmine/Gemfile +2 -2
  6. data/jasmine/HowToRelease.markdown +29 -0
  7. data/jasmine/MIT.LICENSE +1 -1
  8. data/jasmine/README.markdown +37 -15
  9. data/jasmine/Rakefile +42 -58
  10. data/jasmine/example/spec/SpecHelper.js +3 -3
  11. data/jasmine/images/jasmine_favicon.png +0 -0
  12. data/jasmine/jshint/jshint.js +5919 -0
  13. data/jasmine/jshint/run.js +98 -0
  14. data/jasmine/lib/jasmine-html.js +5 -3
  15. data/jasmine/lib/jasmine.js +56 -32
  16. data/jasmine/spec/node_suite.js +233 -0
  17. data/jasmine/spec/runner.html +4 -2
  18. data/jasmine/spec/suites/EnvSpec.js +1 -1
  19. data/jasmine/spec/suites/ExceptionsSpec.js +2 -2
  20. data/jasmine/spec/suites/JsApiReporterSpec.js +1 -1
  21. data/jasmine/spec/suites/MatchersSpec.js +9 -9
  22. data/jasmine/spec/suites/MultiReporterSpec.js +3 -3
  23. data/jasmine/spec/suites/SpecRunningSpec.js +1 -1
  24. data/jasmine/spec/suites/SpecSpec.js +1 -1
  25. data/jasmine/spec/suites/TrivialConsoleReporterSpec.js +431 -0
  26. data/jasmine/spec/suites/UtilSpec.js +0 -1
  27. data/jasmine/spec/suites/WaitsForBlockSpec.js +32 -1
  28. data/jasmine/src/Env.js +2 -2
  29. data/jasmine/src/Matchers.js +3 -3
  30. data/jasmine/src/PrettyPrinter.js +2 -1
  31. data/jasmine/src/WaitsBlock.js +3 -1
  32. data/jasmine/src/WaitsForBlock.js +4 -2
  33. data/jasmine/src/base.js +39 -20
  34. data/jasmine/src/console/TrivialConsoleReporter.js +144 -0
  35. data/jasmine/src/html/TrivialReporter.js +5 -3
  36. data/jasmine/src/util.js +1 -1
  37. data/jasmine/src/version.json +2 -2
  38. data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine.yml +1 -1
  39. data/lib/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml +1 -1
  40. data/lib/jasmine.rb +1 -20
  41. data/lib/jasmine/railtie.rb +20 -0
  42. data/lib/jasmine/run.html.erb +2 -1
  43. data/lib/jasmine/version.rb +2 -2
  44. data/spec/spec_helper.rb +0 -2
  45. metadata +16 -58
  46. data/install.rb +0 -2
  47. data/jasmine/images/fail-16.png +0 -0
  48. data/jasmine/images/fail.png +0 -0
  49. data/jasmine/images/go-16.png +0 -0
  50. data/jasmine/images/go.png +0 -0
  51. data/jasmine/images/pending-16.png +0 -0
  52. data/jasmine/images/pending.png +0 -0
  53. data/jasmine/images/question-bk.png +0 -0
  54. data/jasmine/images/questionbk-16.png +0 -0
  55. data/jasmine/images/spinner.gif +0 -0
  56. data/lib/jasmine/generator.rb +0 -9
@@ -8,7 +8,7 @@
8
8
  // yes, really keep this here to keep us honest, but only for jasmine's own runner! [xw]
9
9
  undefined = "diz be undefined yo";
10
10
  </script>
11
-
11
+ <link rel="shortcut icon" type="image/png" href="../images/jasmine_favicon.png">
12
12
  <script type="text/javascript" src="../src/base.js"></script>
13
13
  <script type="text/javascript" src="../src/util.js"></script>
14
14
  <script type="text/javascript" src="../src/Env.js"></script>
@@ -29,6 +29,7 @@
29
29
  <script type="text/javascript" src="../src/WaitsForBlock.js"></script>
30
30
 
31
31
  <script type="text/javascript" src="../src/html/TrivialReporter.js"></script>
32
+ <script type="text/javascript" src="../src/console/TrivialConsoleReporter.js"></script>
32
33
 
33
34
 
34
35
 
@@ -50,6 +51,7 @@
50
51
  <script type="text/javascript" src="suites/SpySpec.js"></script>
51
52
  <script type="text/javascript" src="suites/SuiteSpec.js"></script>
52
53
  <script type="text/javascript" src="suites/TrivialReporterSpec.js"></script>
54
+ <script type="text/javascript" src="suites/TrivialConsoleReporterSpec.js"></script>
53
55
  <script type="text/javascript" src="suites/WaitsForBlockSpec.js"></script>
54
56
 
55
57
 
@@ -77,4 +79,4 @@
77
79
 
78
80
  <body>
79
81
  </body>
80
- </html>
82
+ </html>
@@ -108,7 +108,7 @@ describe("jasmine.Env", function() {
108
108
 
109
109
  it("should give custom equality testers precedence", function() {
110
110
  expect(env.equals_('abc', 'abc')).toBeFalsy();
111
- var o = new Object();
111
+ var o = {};
112
112
  expect(env.equals_(o, o)).toBeFalsy();
113
113
  });
114
114
  });
@@ -89,9 +89,9 @@ describe('Exceptions:', function() {
89
89
  expect(blockResults[0].message).toMatch(/fake error 1/);
90
90
 
91
91
  expect(specResults[1].passed()).toEqual(false);
92
- var blockResults = specResults[1].getItems();
92
+ blockResults = specResults[1].getItems();
93
93
  expect(blockResults[0].passed()).toEqual(false);
94
- expect(blockResults[0].message).toMatch(/fake error 2/),
94
+ expect(blockResults[0].message).toMatch(/fake error 2/);
95
95
  expect(blockResults[1].passed()).toEqual(true);
96
96
 
97
97
  expect(specResults[2].passed()).toEqual(true);
@@ -21,7 +21,7 @@ describe('jasmine.jsApiReporter', function() {
21
21
  nestedSuite = env.describe("nested suite", function() {
22
22
  nestedSpec = env.it("nested spec", function() {
23
23
  expect(true).toEqual(true);
24
- })
24
+ });
25
25
  });
26
26
 
27
27
  spec3 = env.it("spec 3", function() {
@@ -18,7 +18,7 @@ describe("jasmine.Matchers", function() {
18
18
  toFail: function() {
19
19
  return !lastResult().passed();
20
20
  }
21
- })
21
+ });
22
22
  });
23
23
 
24
24
  function match(value) {
@@ -68,15 +68,15 @@ describe("jasmine.Matchers", function() {
68
68
  expect((match(['a', 'b']).toEqual(['a', jasmine.undefined]))).toFail();
69
69
  expect((match(['a', 'b']).toEqual(['a', 'b', jasmine.undefined]))).toFail();
70
70
 
71
- expect((match(new String("cat")).toEqual("cat"))).toPass();
72
- expect((match(new String("cat")).toNotEqual("cat"))).toFail();
71
+ expect((match("cat").toEqual("cat"))).toPass();
72
+ expect((match("cat").toNotEqual("cat"))).toFail();
73
73
 
74
- expect((match(new Number(5)).toEqual(5))).toPass();
75
- expect((match(new Number('5')).toEqual(5))).toPass();
76
- expect((match(new Number(5)).toNotEqual(5))).toFail();
77
- expect((match(new Number('5')).toNotEqual(5))).toFail();
74
+ expect((match(5).toEqual(5))).toPass();
75
+ expect((match(parseInt('5', 10)).toEqual(5))).toPass();
76
+ expect((match(5).toNotEqual(5))).toFail();
77
+ expect((match(parseInt('5', 10)).toNotEqual(5))).toFail();
78
78
  });
79
-
79
+
80
80
  it("toEqual with DOM nodes", function() {
81
81
  var nodeA = document.createElement('div');
82
82
  var nodeB = document.createElement('div');
@@ -500,7 +500,7 @@ describe("jasmine.Matchers", function() {
500
500
  describe("and matcher is inverted with .not", function() {
501
501
  it("should match any exception", function() {
502
502
  expect(match(throwingFn).not.toThrow()).toFail();
503
- expect(lastResult().message).toMatch(/Expected function not to throw an exception/);
503
+ expect(lastResult().message).toMatch(/Expected function not to throw an exception/);
504
504
  });
505
505
 
506
506
  it("should match exceptions specified by message", function() {
@@ -18,9 +18,9 @@ describe("jasmine.MultiReporter", function() {
18
18
  delegate[methodName] = jasmine.createSpy(methodName);
19
19
  this.actual[methodName]("whatever argument");
20
20
 
21
- return delegate[methodName].wasCalled
22
- && delegate[methodName].mostRecentCall.args.length == 1
23
- && delegate[methodName].mostRecentCall.args[0] == "whatever argument";
21
+ return delegate[methodName].wasCalled &&
22
+ delegate[methodName].mostRecentCall.args.length == 1 &&
23
+ delegate[methodName].mostRecentCall.args[0] == "whatever argument";
24
24
  }
25
25
  });
26
26
 
@@ -54,7 +54,7 @@ describe("jasmine spec running", function () {
54
54
  this.expect(foo).toEqual('baz');
55
55
  });
56
56
 
57
- specWithMultipleExpectations = env.it('spec with multiple assertions').runs(function () {
57
+ specWithMultipleExpectations = env.it('spec with multiple expectations').runs(function () {
58
58
  var foo = 'bar';
59
59
  var baz = 'quux';
60
60
 
@@ -38,7 +38,7 @@ describe('Spec', function () {
38
38
 
39
39
  it('getFullName returns suite & spec description', function () {
40
40
  var spec = new jasmine.Spec(env, suite, 'spec 1');
41
- expect(spec.getFullName()).toEqual('suite 1 spec 1.')
41
+ expect(spec.getFullName()).toEqual('suite 1 spec 1.');
42
42
  });
43
43
 
44
44
  describe('results', function () {
@@ -0,0 +1,431 @@
1
+ if (jasmine.TrivialConsoleReporter) {
2
+ describe("TrivialConsoleReporter", function() {
3
+
4
+
5
+ //keep these literal. otherwise the test loses value as a test.
6
+ function green(str) { return '\033[32m' + str + '\033[0m'; }
7
+ function red(str) { return '\033[31m' + str + '\033[0m'; }
8
+ function yellow(str) { return '\033[33m' + str + '\033[0m'; }
9
+
10
+ function prefixGreen(str) { return '\033[32m' + str; }
11
+ function prefixRed(str) { return '\033[31m' + str; }
12
+
13
+ var newline = "\n";
14
+
15
+ var passingSpec = { results: function(){ return {passed: function(){return true;}}; } },
16
+ failingSpec = { results: function(){ return {passed: function(){return false;}}; } },
17
+ skippedSpec = { results: function(){ return {skipped: true}; } },
18
+ passingRun = { results: function(){ return {failedCount: 0, items_: [null, null, null]}; } },
19
+ failingRun = { results: function(){ return {failedCount: 7, items_: [null, null, null]}; } };
20
+
21
+ function repeatedlyInvoke(f, times) { for(var i=0; i<times; i++) f(times+1); }
22
+
23
+ function repeat(thing, times) {
24
+ var arr = [];
25
+ for(var i=0; i<times; i++) arr.push(thing);
26
+ return arr;
27
+ }
28
+
29
+ var fiftyRedFs = repeat(red("F"), 50).join(""),
30
+ fiftyGreenDots = repeat(green("."), 50).join("");
31
+
32
+ function simulateRun(reporter, specResults, suiteResults, finalRunner, startTime, endTime) {
33
+ reporter.reportRunnerStarting();
34
+ for(var i=0; i<specResults.length; i++) reporter.reportSpecResults(specResults[i]);
35
+ for(i=0; i<suiteResults.length; i++) reporter.reportSuiteResults(suiteResults[i]);
36
+ reporter.runnerStartTime = startTime;
37
+ reporter.now = function(){return endTime;};
38
+ reporter.reportRunnerResults(finalRunner);
39
+ }
40
+
41
+ beforeEach(function() {
42
+ this.out = (function(){
43
+ var output = "";
44
+ return {
45
+ print:function(str) {output += str;},
46
+ getOutput:function(){return output;},
47
+ clear: function(){output = "";}
48
+ };
49
+ })();
50
+
51
+ this.done = false
52
+ var self = this
53
+ this.reporter = new jasmine.TrivialConsoleReporter(this.out.print, function(runner){
54
+ self.done = true
55
+ });
56
+ });
57
+
58
+
59
+ describe('Integration', function(){
60
+ it("prints the proper output under a pass scenario. small numbers.", function(){
61
+ simulateRun(this.reporter,
62
+ repeat(passingSpec, 3),
63
+ [],
64
+ {
65
+ results:function(){
66
+ return {
67
+ items_: [null, null, null],
68
+ totalCount: 7,
69
+ failedCount: 0
70
+ };
71
+ }
72
+ },
73
+ 1000,
74
+ 1777);
75
+
76
+ expect(this.out.getOutput()).toEqual(
77
+ [
78
+ "Started",
79
+ green(".") + green(".") + green("."),
80
+ "",
81
+ "Finished in 0.777 seconds",
82
+ green("3 specs, 7 expectations, 0 failures"),
83
+ ""
84
+ ].join("\n") + "\n"
85
+ );
86
+ });
87
+
88
+ it("prints the proper output under a pass scenario. large numbers.", function(){
89
+ simulateRun(this.reporter,
90
+ repeat(passingSpec, 57),
91
+ [],
92
+ {
93
+ results:function(){
94
+ return {
95
+ items_: [null, null, null],
96
+ totalCount: 7,
97
+ failedCount: 0
98
+ };
99
+ }
100
+ },
101
+ 1000,
102
+ 1777);
103
+
104
+ expect(this.out.getOutput()).toEqual(
105
+ [
106
+ "Started",
107
+
108
+ green(".") + green(".") + green(".") + green(".") + green(".") + //50 green dots
109
+ green(".") + green(".") + green(".") + green(".") + green(".") +
110
+ green(".") + green(".") + green(".") + green(".") + green(".") +
111
+ green(".") + green(".") + green(".") + green(".") + green(".") +
112
+ green(".") + green(".") + green(".") + green(".") + green(".") +
113
+ green(".") + green(".") + green(".") + green(".") + green(".") +
114
+ green(".") + green(".") + green(".") + green(".") + green(".") +
115
+ green(".") + green(".") + green(".") + green(".") + green(".") +
116
+ green(".") + green(".") + green(".") + green(".") + green(".") +
117
+ green(".") + green(".") + green(".") + green(".") + green(".") + newline +
118
+
119
+ green(".") + green(".") + green(".") + green(".") + green(".") + //7 green dots
120
+ green(".") + green("."),
121
+
122
+ "",
123
+ "Finished in 0.777 seconds",
124
+ green("3 specs, 7 expectations, 0 failures"),
125
+ ""
126
+ ].join("\n") + "\n"
127
+ );
128
+ });
129
+
130
+
131
+ it("prints the proper output under a failure scenario.", function(){
132
+ simulateRun(this.reporter,
133
+ [failingSpec, passingSpec, failingSpec],
134
+ [{description:"The oven",
135
+ results:function(){
136
+ return {
137
+ items_:[
138
+ {failedCount:2,
139
+ description:"heats up",
140
+ items_:[
141
+ {trace:{stack:"stack trace one\n second line"}},
142
+ {trace:{stack:"stack trace two"}}
143
+ ]}
144
+ ]
145
+ };
146
+ }},
147
+ {description:"The washing machine",
148
+ results:function(){
149
+ return {
150
+ items_:[
151
+ {failedCount:2,
152
+ description:"washes clothes",
153
+ items_:[
154
+ {trace:{stack:"stack trace one"}}
155
+ ]}
156
+ ]
157
+ };
158
+ }}
159
+ ],
160
+ {
161
+ results:function(){
162
+ return {
163
+ items_: [null, null, null],
164
+ totalCount: 7,
165
+ failedCount: 2
166
+ };
167
+ }
168
+ },
169
+ 1000,
170
+ 1777);
171
+
172
+ expect(this.out.getOutput()).toEqual(
173
+ [
174
+ "Started",
175
+ red("F") + green(".") + red("F"),
176
+ "",
177
+ "The oven heats up",
178
+ " stack trace one",
179
+ " second line",
180
+ " stack trace two",
181
+ "",
182
+ "The washing machine washes clothes",
183
+ " stack trace one",
184
+ "",
185
+ "Finished in 0.777 seconds",
186
+ red("3 specs, 7 expectations, 2 failures"),
187
+ ""
188
+ ].join("\n") + "\n"
189
+ );
190
+ });
191
+
192
+
193
+ });
194
+
195
+ describe('A Test Run', function(){
196
+
197
+ describe('Starts', function(){
198
+ it("prints Started", function(){
199
+ this.reporter.reportRunnerStarting();
200
+
201
+ expect(this.out.getOutput()).toEqual(
202
+ "Started" + newline
203
+ );
204
+ });
205
+ });
206
+
207
+ describe('A spec runs', function(){
208
+ it("prints a green dot if the spec passes", function(){
209
+ this.reporter.reportSpecResults(passingSpec);
210
+
211
+ expect(this.out.getOutput()).toEqual(
212
+ green(".")
213
+ );
214
+ });
215
+
216
+ it("prints a red dot if the spec fails", function(){
217
+ this.reporter.reportSpecResults(failingSpec);
218
+
219
+ expect(this.out.getOutput()).toEqual(
220
+ red("F")
221
+ );
222
+ });
223
+
224
+ it("prints a yellow star if the spec was skipped", function(){
225
+ this.reporter.reportSpecResults(skippedSpec);
226
+
227
+ expect(this.out.getOutput()).toEqual(
228
+ yellow("*")
229
+ );
230
+ });
231
+ });
232
+
233
+
234
+ describe('Many specs run', function(){
235
+ it("starts a new line every 50 specs", function(){
236
+ var self = this;
237
+ repeatedlyInvoke(function(){self.reporter.reportSpecResults(failingSpec);}, 49);
238
+
239
+ expect(this.out.getOutput()).
240
+ toEqual(repeat(red("F"), 49).join(""));
241
+
242
+ repeatedlyInvoke(function(){self.reporter.reportSpecResults(failingSpec);}, 3);
243
+
244
+ expect(this.out.getOutput()).
245
+ toEqual(fiftyRedFs + newline +
246
+ red("F") + red("F"));
247
+
248
+ repeatedlyInvoke(function(){self.reporter.reportSpecResults(failingSpec);}, 48);
249
+ repeatedlyInvoke(function(){self.reporter.reportSpecResults(passingSpec);}, 2);
250
+
251
+ expect(this.out.getOutput()).
252
+ toEqual(fiftyRedFs + newline +
253
+ fiftyRedFs + newline +
254
+ green(".") + green("."));
255
+ });
256
+ });
257
+
258
+ describe('A suite runs', function(){
259
+ it("remembers suite results", function(){
260
+ var emptyResults = function(){return {items_:[]};};
261
+ this.reporter.reportSuiteResults({description:"Oven", results:emptyResults});
262
+ this.reporter.reportSuiteResults({description:"Mixer", results:emptyResults});
263
+
264
+ var self = this;
265
+ var descriptions = [];
266
+ for(var i=0; i<self.reporter.suiteResults.length; i++)
267
+ descriptions.push(self.reporter.suiteResults[i].description);
268
+
269
+ expect(descriptions).toEqual(["Oven", "Mixer"]);
270
+ });
271
+
272
+ it("creates a description out of the current suite and any parent suites", function(){
273
+ var emptyResults = function(){return {items_:[]};};
274
+ var grandparentSuite = {description:"My house", results:emptyResults};
275
+ var parentSuite = {description:"kitchen", parentSuite: grandparentSuite, results:emptyResults};
276
+ this.reporter.reportSuiteResults({description:"oven", parentSuite: parentSuite, results:emptyResults});
277
+
278
+ expect(this.reporter.suiteResults[0].description).toEqual("My house kitchen oven");
279
+ });
280
+
281
+ it("gathers failing spec results from the suite. the spec must have a description.", function(){
282
+ this.reporter.reportSuiteResults({description:"Oven",
283
+ results:function(){
284
+ return {
285
+ items_:[
286
+ {failedCount:0, description:"specOne"},
287
+ {failedCount:99, description:"specTwo"},
288
+ {failedCount:0, description:"specThree"},
289
+ {failedCount:88, description:"specFour"},
290
+ {failedCount:3}
291
+ ]
292
+ };
293
+ }});
294
+
295
+ expect(this.reporter.suiteResults[0].failedSpecResults).
296
+ toEqual([
297
+ {failedCount:99, description:"specTwo"},
298
+ {failedCount:88, description:"specFour"}
299
+ ]);
300
+ });
301
+
302
+ });
303
+
304
+ describe('Finishes', function(){
305
+
306
+ describe('Spec failure information', function(){
307
+
308
+ it("prints suite and spec descriptions together as a sentence", function(){
309
+ this.reporter.suiteResults = [
310
+ {description:"The oven", failedSpecResults:[
311
+ {description:"heats up", items_:[]},
312
+ {description:"cleans itself", items_:[]}
313
+ ]},
314
+ {description:"The mixer", failedSpecResults:[
315
+ {description:"blends things together", items_:[]}
316
+ ]}
317
+ ];
318
+
319
+ this.reporter.reportRunnerResults(failingRun);
320
+
321
+ expect(this.out.getOutput()).toContain("The oven heats up");
322
+ expect(this.out.getOutput()).toContain("The oven cleans itself");
323
+ expect(this.out.getOutput()).toContain("The mixer blends things together");
324
+ });
325
+
326
+ it("prints stack trace of spec failure", function(){
327
+ this.reporter.suiteResults = [
328
+ {description:"The oven", failedSpecResults:[
329
+ {description:"heats up",
330
+ items_:[
331
+ {trace:{stack:"stack trace one"}},
332
+ {trace:{stack:"stack trace two"}}
333
+ ]}
334
+ ]}
335
+ ];
336
+
337
+ this.reporter.reportRunnerResults(failingRun);
338
+
339
+ expect(this.out.getOutput()).toContain("The oven heats up");
340
+ expect(this.out.getOutput()).toContain("stack trace one");
341
+ expect(this.out.getOutput()).toContain("stack trace two");
342
+ });
343
+
344
+ });
345
+
346
+ describe('Finished line', function(){
347
+
348
+ it("prints the elapsed time in the summary message", function(){
349
+ this.reporter.now = function(){return 1000;};
350
+ this.reporter.reportRunnerStarting();
351
+ this.reporter.now = function(){return 1777;};
352
+ this.reporter.reportRunnerResults(passingRun);
353
+ expect(this.out.getOutput()).toContain("0.777 seconds");
354
+ });
355
+
356
+ it("prints round time numbers correctly", function(){
357
+ var self = this;
358
+ function run(startTime, endTime) {
359
+ self.out.clear();
360
+ self.reporter.runnerStartTime = startTime;
361
+ self.reporter.now = function(){return endTime;};
362
+ self.reporter.reportRunnerResults(passingRun);
363
+ }
364
+
365
+ run(1000, 11000);
366
+ expect(this.out.getOutput()).toContain("10 seconds");
367
+
368
+ run(1000, 2000);
369
+ expect(this.out.getOutput()).toContain("1 seconds");
370
+
371
+ run(1000, 1100);
372
+ expect(this.out.getOutput()).toContain("0.1 seconds");
373
+
374
+ run(1000, 1010);
375
+ expect(this.out.getOutput()).toContain("0.01 seconds");
376
+
377
+ run(1000, 1001);
378
+ expect(this.out.getOutput()).toContain("0.001 seconds");
379
+ });
380
+
381
+ it("prints the full finished message", function(){
382
+ this.reporter.now = function(){return 1000;};
383
+ this.reporter.reportRunnerStarting();
384
+ this.reporter.now = function(){return 1777;};
385
+ this.reporter.reportRunnerResults(failingRun);
386
+ expect(this.out.getOutput()).toContain("Finished in 0.777 seconds");
387
+ });
388
+ });
389
+
390
+ describe("specs/expectations/failures summary", function(){
391
+ it("prints statistics in green if there were no failures", function() {
392
+ this.reporter.reportRunnerResults({
393
+ results:function(){return {items_: [null, null, null], totalCount: 7, failedCount: 0};}
394
+ });
395
+ expect(this.out.getOutput()).
396
+ toContain("3 specs, 7 expectations, 0 failures");
397
+ });
398
+
399
+ it("prints statistics in red if there was a failure", function() {
400
+ this.reporter.reportRunnerResults({
401
+ results:function(){return {items_: [null, null, null], totalCount: 7, failedCount: 3};}
402
+ });
403
+ expect(this.out.getOutput()).
404
+ toContain("3 specs, 7 expectations, 3 failures");
405
+ });
406
+
407
+ it("handles pluralization with 1's ones appropriately", function() {
408
+ this.reporter.reportRunnerResults({
409
+ results:function(){return {items_: [null], totalCount: 1, failedCount: 1};}
410
+ });
411
+ expect(this.out.getOutput()).
412
+ toContain("1 spec, 1 expectation, 1 failure");
413
+ });
414
+ });
415
+
416
+ describe("done callback", function(){
417
+ it("calls back when done", function() {
418
+ expect(this.done).toBeFalsy();
419
+ this.reporter.reportRunnerResults({
420
+ results:function(){return {items_: [null, null, null], totalCount: 7, failedCount: 0};}
421
+ });
422
+ expect(this.done).toBeTruthy();
423
+ });
424
+ });
425
+
426
+ });
427
+
428
+ });
429
+
430
+ });
431
+ }