evergreen 1.0.0.rc → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/README.rdoc +10 -2
  2. data/config/routes.rb +1 -1
  3. data/lib/evergreen.rb +2 -6
  4. data/lib/evergreen/application.rb +38 -59
  5. data/lib/evergreen/cli.rb +2 -2
  6. data/lib/evergreen/runner.rb +6 -3
  7. data/lib/evergreen/server.rb +1 -5
  8. data/lib/evergreen/suite.rb +1 -13
  9. data/lib/evergreen/tasks.rb +1 -1
  10. data/lib/evergreen/version.rb +1 -1
  11. data/lib/jasmine/Contribute.markdown +44 -0
  12. data/lib/jasmine/Gemfile +4 -6
  13. data/lib/jasmine/MIT.LICENSE +1 -1
  14. data/lib/jasmine/README.markdown +17 -14
  15. data/lib/jasmine/Rakefile +21 -170
  16. data/lib/jasmine/Release.markdown +40 -0
  17. data/lib/jasmine/images/jasmine_favicon.png +0 -0
  18. data/lib/jasmine/jasmine-core.gemspec +22 -0
  19. data/lib/jasmine/jshint/jshint.js +5919 -0
  20. data/lib/jasmine/jshint/run.js +99 -0
  21. data/lib/jasmine/lib/jasmine-core.rb +36 -0
  22. data/lib/jasmine/lib/jasmine-core/example/SpecRunner.html +54 -0
  23. data/lib/jasmine/{example → lib/jasmine-core/example}/spec/PlayerSpec.js +0 -0
  24. data/lib/jasmine/{example → lib/jasmine-core/example}/spec/SpecHelper.js +3 -3
  25. data/lib/jasmine/{example → lib/jasmine-core/example}/src/Player.js +0 -0
  26. data/lib/jasmine/{example → lib/jasmine-core/example}/src/Song.js +0 -0
  27. data/lib/jasmine/lib/{jasmine-html.js → jasmine-core/jasmine-html.js} +6 -4
  28. data/lib/jasmine/lib/{jasmine.css → jasmine-core/jasmine.css} +0 -0
  29. data/lib/jasmine/lib/{jasmine.js → jasmine-core/jasmine.js} +103 -48
  30. data/lib/jasmine/lib/{json2.js → jasmine-core/json2.js} +0 -0
  31. data/lib/jasmine/lib/jasmine-core/version.rb +6 -0
  32. data/lib/jasmine/spec/console/ConsoleReporterSpec.js +451 -0
  33. data/lib/jasmine/spec/{suites → core}/BaseSpec.js +0 -0
  34. data/lib/jasmine/spec/{suites → core}/CustomMatchersSpec.js +0 -0
  35. data/lib/jasmine/spec/{suites → core}/EnvSpec.js +3 -2
  36. data/lib/jasmine/spec/{suites → core}/ExceptionsSpec.js +46 -4
  37. data/lib/jasmine/spec/{suites → core}/JsApiReporterSpec.js +1 -1
  38. data/lib/jasmine/spec/{suites → core}/MatchersSpec.js +87 -44
  39. data/lib/jasmine/spec/{suites → core}/MockClockSpec.js +0 -0
  40. data/lib/jasmine/spec/{suites → core}/MultiReporterSpec.js +3 -3
  41. data/lib/jasmine/spec/{suites → core}/NestedResultsSpec.js +0 -0
  42. data/lib/jasmine/spec/{suites → core}/PrettyPrintSpec.js +0 -6
  43. data/lib/jasmine/spec/{suites → core}/QueueSpec.js +0 -0
  44. data/lib/jasmine/spec/{suites → core}/ReporterSpec.js +0 -0
  45. data/lib/jasmine/spec/{suites → core}/RunnerSpec.js +0 -0
  46. data/lib/jasmine/spec/{suites → core}/SpecRunningSpec.js +14 -9
  47. data/lib/jasmine/spec/{suites → core}/SpecSpec.js +1 -1
  48. data/lib/jasmine/spec/{suites → core}/SpySpec.js +0 -0
  49. data/lib/jasmine/spec/{suites → core}/SuiteSpec.js +0 -0
  50. data/lib/jasmine/spec/{suites → core}/UtilSpec.js +0 -1
  51. data/lib/jasmine/spec/{suites → core}/WaitsForBlockSpec.js +32 -1
  52. data/lib/jasmine/spec/html/MatchersHtmlSpec.js +38 -0
  53. data/lib/jasmine/spec/html/PrettyPrintHtmlSpec.js +8 -0
  54. data/lib/jasmine/spec/{suites → html}/TrivialReporterSpec.js +3 -2
  55. data/lib/jasmine/spec/node_suite.js +127 -0
  56. data/lib/jasmine/spec/runner.html +44 -45
  57. data/lib/jasmine/spec/templates/runner.html.erb +49 -0
  58. data/lib/jasmine/spec/templates/script_tag.html.erb +1 -0
  59. data/lib/jasmine/src/SourcesList.json +7 -0
  60. data/lib/jasmine/src/console/ConsoleReporter.js +177 -0
  61. data/lib/jasmine/src/{Block.js → core/Block.js} +1 -1
  62. data/lib/jasmine/src/{Env.js → core/Env.js} +13 -8
  63. data/lib/jasmine/src/{JsApiReporter.js → core/JsApiReporter.js} +0 -0
  64. data/lib/jasmine/src/{Matchers.js → core/Matchers.js} +24 -7
  65. data/lib/jasmine/src/{MultiReporter.js → core/MultiReporter.js} +0 -0
  66. data/lib/jasmine/src/{NestedResults.js → core/NestedResults.js} +0 -0
  67. data/lib/jasmine/src/{PrettyPrinter.js → core/PrettyPrinter.js} +2 -1
  68. data/lib/jasmine/src/{Queue.js → core/Queue.js} +0 -0
  69. data/lib/jasmine/src/{Reporter.js → core/Reporter.js} +0 -0
  70. data/lib/jasmine/src/{Runner.js → core/Runner.js} +1 -1
  71. data/lib/jasmine/src/{Spec.js → core/Spec.js} +2 -1
  72. data/lib/jasmine/src/{Suite.js → core/Suite.js} +1 -1
  73. data/lib/jasmine/src/{WaitsBlock.js → core/WaitsBlock.js} +3 -1
  74. data/lib/jasmine/src/{WaitsForBlock.js → core/WaitsForBlock.js} +4 -2
  75. data/lib/jasmine/src/{base.js → core/base.js} +52 -24
  76. data/lib/jasmine/src/{mock-timeout.js → core/mock-timeout.js} +0 -0
  77. data/lib/jasmine/src/{util.js → core/util.js} +1 -1
  78. data/lib/jasmine/src/html/TrivialReporter.js +6 -4
  79. data/lib/jasmine/src/templates/example_project_jasmine_tags.html.erb +3 -0
  80. data/lib/jasmine/src/templates/version.js.erb +6 -0
  81. data/lib/jasmine/src/templates/version.rb.erb +6 -0
  82. data/lib/jasmine/src/version.js +6 -0
  83. data/lib/jasmine/src/version.json +2 -2
  84. data/lib/jasmine/tasks/build_dist.rb +48 -0
  85. data/lib/jasmine/tasks/build_specs.rb +50 -0
  86. data/lib/jasmine/tasks/docs.rb +17 -0
  87. data/lib/jasmine/tasks/helpers.rb +50 -0
  88. data/lib/jasmine/tasks/pages.rb +13 -0
  89. data/lib/jasmine/tasks/spec.rb +37 -0
  90. data/lib/jasmine/tasks/standalone.rb +91 -0
  91. data/lib/jasmine/tasks/version.rb +5 -0
  92. data/lib/tasks/evergreen.rake +1 -1
  93. data/spec/evergreen_spec.rb +6 -7
  94. data/spec/runner_spec.rb +1 -1
  95. data/spec/spec_helper.rb +5 -8
  96. metadata +95 -77
  97. data/lib/jasmine/cruise_config.rb +0 -21
  98. data/lib/jasmine/example/SpecRunner.html +0 -27
  99. data/lib/jasmine/images/fail-16.png +0 -0
  100. data/lib/jasmine/images/fail.png +0 -0
  101. data/lib/jasmine/images/go-16.png +0 -0
  102. data/lib/jasmine/images/go.png +0 -0
  103. data/lib/jasmine/images/pending-16.png +0 -0
  104. data/lib/jasmine/images/pending.png +0 -0
  105. data/lib/jasmine/images/question-bk.png +0 -0
  106. data/lib/jasmine/images/questionbk-16.png +0 -0
  107. data/lib/jasmine/images/spinner.gif +0 -0
@@ -0,0 +1,6 @@
1
+ module Jasmine
2
+ module Core
3
+ VERSION = "1.1.0"
4
+ end
5
+ end
6
+
@@ -0,0 +1,451 @@
1
+ describe("ConsoleReporter", function() {
2
+ //keep these literal. otherwise the test loses value as a test.
3
+ function green(str) {
4
+ return '\033[32m' + str + '\033[0m';
5
+ }
6
+
7
+ function red(str) {
8
+ return '\033[31m' + str + '\033[0m';
9
+ }
10
+
11
+ function yellow(str) {
12
+ return '\033[33m' + str + '\033[0m';
13
+ }
14
+
15
+ function prefixGreen(str) {
16
+ return '\033[32m' + str;
17
+ }
18
+
19
+ function prefixRed(str) {
20
+ return '\033[31m' + str;
21
+ }
22
+
23
+ var newline = "\n";
24
+
25
+ var passingSpec = {
26
+ results: function() {
27
+ return {
28
+ passed: function() {
29
+ return true;
30
+ }
31
+ };
32
+ }
33
+ },
34
+ failingSpec = {
35
+ results: function() {
36
+ return {
37
+ passed: function() {
38
+ return false;
39
+ }
40
+ };
41
+ }
42
+ },
43
+ skippedSpec = {
44
+ results: function() {
45
+ return {skipped: true};
46
+ }
47
+ },
48
+ passingRun = {
49
+ specs: function() {
50
+ return [null, null, null];
51
+ },
52
+ results: function() {
53
+ return {failedCount: 0, items_: [null, null, null]};
54
+ }
55
+ },
56
+ failingRun = {
57
+ specs: function() {
58
+ return [null, null, null];
59
+ },
60
+ results: function() {
61
+ return {
62
+ failedCount: 7, items_: [null, null, null]};
63
+ }
64
+ };
65
+
66
+ function repeatedlyInvoke(f, times) {
67
+ for (var i = 0; i < times; i++) f(times + 1);
68
+ }
69
+
70
+ function repeat(thing, times) {
71
+ var arr = [];
72
+ for (var i = 0; i < times; i++) arr.push(thing);
73
+ return arr;
74
+ }
75
+
76
+ function simulateRun(reporter, specResults, suiteResults, finalRunner, startTime, endTime) {
77
+ reporter.reportRunnerStarting();
78
+ for (var i = 0; i < specResults.length; i++) {
79
+ reporter.reportSpecResults(specResults[i]);
80
+ }
81
+ for (i = 0; i < suiteResults.length; i++) {
82
+ reporter.reportSuiteResults(suiteResults[i]);
83
+ }
84
+ reporter.runnerStartTime = startTime;
85
+ reporter.now = function() {
86
+ return endTime;
87
+ };
88
+ reporter.reportRunnerResults(finalRunner);
89
+ }
90
+
91
+ var reporter, out, done;
92
+
93
+ beforeEach(function() {
94
+ out = (function() {
95
+ var output = "";
96
+ return {
97
+ print:function(str) {
98
+ output += str;
99
+ },
100
+ getOutput:function() {
101
+ return output;
102
+ },
103
+ clear: function() {
104
+ output = "";
105
+ }
106
+ };
107
+ })();
108
+
109
+ done = false;
110
+ reporter = new jasmine.ConsoleReporter(out.print, function(runner) {
111
+ done = true
112
+ });
113
+ });
114
+
115
+
116
+ describe('Integration', function() {
117
+ it("prints the proper output under a pass scenario - small numbers.", function() {
118
+ simulateRun(reporter,
119
+ repeat(passingSpec, 3),
120
+ [],
121
+ {
122
+ specs: function() {
123
+ return [null, null, null];
124
+ },
125
+ results:function() {
126
+ return {
127
+ items_: [null, null, null],
128
+ totalCount: 7,
129
+ failedCount: 0
130
+ };
131
+ }
132
+ },
133
+ 1000,
134
+ 1777
135
+ );
136
+
137
+ var output = out.getOutput();
138
+ expect(output).toMatch(/^Started/);
139
+ expect(output).toMatch(/\.\.\./);
140
+ expect(output).toMatch(/3 specs, 0 failures/);
141
+ });
142
+
143
+ it("prints the proper output under a pass scenario. large numbers.", function() {
144
+ simulateRun(reporter,
145
+ repeat(passingSpec, 57),
146
+ [],
147
+ {
148
+ specs: function() {
149
+ return [null, null, null];
150
+ },
151
+ results:function() {
152
+ return {
153
+ items_: [null, null, null],
154
+ totalCount: 7,
155
+ failedCount: 0
156
+ };
157
+ }
158
+ },
159
+ 1000,
160
+ 1777);
161
+
162
+ var output = out.getOutput();
163
+ expect(output).toMatch(/^Started/);
164
+ expect(output).toMatch(/\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\.\./);
165
+ expect(output).toMatch(/3 specs, 0 failures/);
166
+ });
167
+
168
+ it("prints the proper output under a failure scenario.", function() {
169
+ simulateRun(reporter,
170
+ [failingSpec, passingSpec, failingSpec],
171
+ [
172
+ {description:"The oven",
173
+ results:function() {
174
+ return {
175
+ items_:[
176
+ {failedCount:2,
177
+ description:"heats up",
178
+ items_:[
179
+ {trace:{stack:"stack trace one\n second line"}},
180
+ {trace:{stack:"stack trace two"}}
181
+ ]}
182
+ ]
183
+ };
184
+ }},
185
+ {description:"The washing machine",
186
+ results:function() {
187
+ return {
188
+ items_:[
189
+ {failedCount:2,
190
+ description:"washes clothes",
191
+ items_:[
192
+ {trace:{stack:"stack trace one"}}
193
+ ]}
194
+ ]
195
+ };
196
+ }}
197
+ ],
198
+ {
199
+ specs: function() {
200
+ return [null, null, null];
201
+ },
202
+ results:function() {
203
+ return {
204
+ items_: [null, null, null],
205
+ totalCount: 7,
206
+ failedCount: 2
207
+ };
208
+ }
209
+ },
210
+ 1000,
211
+ 1777);
212
+
213
+ var output = out.getOutput();
214
+ expect(output).toMatch(/^Started/);
215
+ expect(output).toMatch(/F\.F/);
216
+ expect(output).toMatch(/The oven heats up\n stack trace one\n second line\n stack trace two/);
217
+ expect(output).toMatch(/The washing machine washes clothes\n stack trace one/);
218
+ expect(output).toMatch(/3 specs, 2 failures/);
219
+ });
220
+ });
221
+
222
+ describe('When a Jasmine environment executes', function() {
223
+ beforeEach(function() {
224
+ reporter.reportRunnerStarting();
225
+ });
226
+
227
+ it("should print 'Started' to the console", function() {
228
+ expect(out.getOutput()).toEqual("Started" + newline);
229
+ });
230
+
231
+ describe('when a spec reports', function() {
232
+ beforeEach(function() {
233
+ out.clear();
234
+ });
235
+
236
+ it("prints a green dot if the spec passes", function() {
237
+ reporter.reportSpecResults(passingSpec);
238
+
239
+ expect(out.getOutput()).toMatch(/\./);
240
+ });
241
+
242
+ it("prints a red dot if the spec fails", function() {
243
+ reporter.reportSpecResults(failingSpec);
244
+
245
+ expect(out.getOutput()).toMatch(/F/);
246
+ });
247
+
248
+ it("prints a yellow star if the spec was skipped", function() {
249
+ reporter.reportSpecResults(skippedSpec);
250
+
251
+ expect(out.getOutput()).toMatch(/\*/);
252
+ });
253
+ });
254
+
255
+ describe('when a suite reports', function() {
256
+ var emptyResults;
257
+ beforeEach(function() {
258
+ emptyResults = function() {
259
+ return {
260
+ items_:[]
261
+ };
262
+ };
263
+ });
264
+
265
+ it("remembers suite results", function() {
266
+ reporter.reportSuiteResults({description: "Oven", results: emptyResults});
267
+ reporter.reportSuiteResults({description: "Mixer", results: emptyResults});
268
+
269
+ expect(reporter.suiteResults[0].description).toEqual('Oven');
270
+ expect(reporter.suiteResults[1].description).toEqual('Mixer');
271
+ });
272
+
273
+ it("creates a description out of the current suite and any parent suites", function() {
274
+ var grandparentSuite = {
275
+ description: "My house",
276
+ results: emptyResults
277
+ };
278
+ var parentSuite = {
279
+ description: "kitchen",
280
+ parentSuite: grandparentSuite,
281
+ results: emptyResults
282
+ };
283
+ reporter.reportSuiteResults({ description: "oven", parentSuite: parentSuite, results: emptyResults });
284
+
285
+ expect(reporter.suiteResults[0].description).toEqual("My house kitchen oven");
286
+ });
287
+
288
+ it("gathers failing spec results from the suite - the spec must have a description.", function() {
289
+ reporter.reportSuiteResults({description:"Oven",
290
+ results: function() {
291
+ return {
292
+ items_:[
293
+ { failedCount: 0, description: "specOne" },
294
+ { failedCount: 99, description: "specTwo" },
295
+ { failedCount: 0, description: "specThree" },
296
+ { failedCount: 88, description: "specFour" },
297
+ { failedCount: 3 }
298
+ ]
299
+ };
300
+ }});
301
+
302
+ expect(reporter.suiteResults[0].failedSpecResults).
303
+ toEqual([
304
+ { failedCount: 99, description: "specTwo" },
305
+ { failedCount: 88, description: "specFour" }
306
+ ]);
307
+ });
308
+
309
+ });
310
+
311
+ describe('and finishes', function() {
312
+
313
+ describe('when reporting spec failure information', function() {
314
+
315
+ it("prints suite and spec descriptions together as a sentence", function() {
316
+ reporter.suiteResults = [
317
+ {description:"The oven", failedSpecResults:[
318
+ {description:"heats up", items_:[]},
319
+ {description:"cleans itself", items_:[]}
320
+ ]},
321
+ {description:"The mixer", failedSpecResults:[
322
+ {description:"blends things together", items_:[]}
323
+ ]}
324
+ ];
325
+
326
+ reporter.reportRunnerResults(failingRun);
327
+
328
+ expect(out.getOutput()).toContain("The oven heats up");
329
+ expect(out.getOutput()).toContain("The oven cleans itself");
330
+ expect(out.getOutput()).toContain("The mixer blends things together");
331
+ });
332
+
333
+ it("prints stack trace of spec failure", function() {
334
+ reporter.suiteResults = [
335
+ {description:"The oven", failedSpecResults:[
336
+ {description:"heats up",
337
+ items_:[
338
+ {trace:{stack:"stack trace one"}},
339
+ {trace:{stack:"stack trace two"}}
340
+ ]}
341
+ ]}
342
+ ];
343
+
344
+ reporter.reportRunnerResults(failingRun);
345
+
346
+ expect(out.getOutput()).toContain("The oven heats up");
347
+ expect(out.getOutput()).toContain("stack trace one");
348
+ expect(out.getOutput()).toContain("stack trace two");
349
+ });
350
+
351
+ });
352
+
353
+ describe('when reporting the execution time', function() {
354
+
355
+ it("prints the full finished message", function() {
356
+ reporter.now = function() {
357
+ return 1000;
358
+ };
359
+ reporter.reportRunnerStarting();
360
+ reporter.now = function() {
361
+ return 1777;
362
+ };
363
+ reporter.reportRunnerResults(failingRun);
364
+ expect(out.getOutput()).toContain("Finished in 0.777 seconds");
365
+ });
366
+
367
+ it("prints round time numbers correctly", function() {
368
+ function run(startTime, endTime) {
369
+ out.clear();
370
+ reporter.runnerStartTime = startTime;
371
+ reporter.now = function() {
372
+ return endTime;
373
+ };
374
+ reporter.reportRunnerResults(passingRun);
375
+ }
376
+
377
+ run(1000, 11000);
378
+ expect(out.getOutput()).toContain("10 seconds");
379
+
380
+ run(1000, 2000);
381
+ expect(out.getOutput()).toContain("1 seconds");
382
+
383
+ run(1000, 1100);
384
+ expect(out.getOutput()).toContain("0.1 seconds");
385
+
386
+ run(1000, 1010);
387
+ expect(out.getOutput()).toContain("0.01 seconds");
388
+
389
+ run(1000, 1001);
390
+ expect(out.getOutput()).toContain("0.001 seconds");
391
+ });
392
+ });
393
+
394
+ describe("when reporting the results summary", function() {
395
+ it("prints statistics in green if there were no failures", function() {
396
+ reporter.reportRunnerResults({
397
+ specs: function() {
398
+ return [null, null, null];
399
+ },
400
+ results:function() {
401
+ return {items_: [null, null, null], totalCount: 7, failedCount: 0};
402
+ }
403
+ });
404
+ expect(out.getOutput()).
405
+ toContain("3 specs, 0 failures");
406
+ });
407
+
408
+ it("prints statistics in red if there was a failure", function() {
409
+ reporter.reportRunnerResults({
410
+ specs: function() {
411
+ return [null, null, null];
412
+ },
413
+ results:function() {
414
+ return {items_: [null, null, null], totalCount: 7, failedCount: 3};
415
+ }
416
+ });
417
+ expect(out.getOutput()).
418
+ toContain("3 specs, 3 failures");
419
+ });
420
+
421
+ it("handles pluralization with 1's ones appropriately", function() {
422
+ reporter.reportRunnerResults({
423
+ specs: function() {
424
+ return [null];
425
+ },
426
+ results:function() {
427
+ return {items_: [null], totalCount: 1, failedCount: 1};
428
+ }
429
+ });
430
+ expect(out.getOutput()).
431
+ toContain("1 spec, 1 failure");
432
+ });
433
+ });
434
+
435
+ describe("done callback", function() {
436
+ it("calls back when done", function() {
437
+ expect(done).toBeFalsy();
438
+ reporter.reportRunnerResults({
439
+ specs: function() {
440
+ return [null, null, null];
441
+ },
442
+ results:function() {
443
+ return {items_: [null, null, null], totalCount: 7, failedCount: 0};
444
+ }
445
+ });
446
+ expect(done).toBeTruthy();
447
+ });
448
+ });
449
+ });
450
+ });
451
+ });