evergreen 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/README.rdoc +3 -3
  2. data/lib/evergreen/resources/evergreen.css +4 -0
  3. data/lib/evergreen/server.rb +1 -1
  4. data/lib/evergreen/version.rb +1 -1
  5. data/lib/jasmine/Gemfile +8 -0
  6. data/lib/jasmine/README.markdown +2 -1
  7. data/lib/jasmine/Rakefile +37 -1
  8. data/lib/jasmine/jasmine-core.gemspec +4 -1
  9. data/lib/jasmine/lib/jasmine-core/jasmine-html.js +77 -12
  10. data/lib/jasmine/lib/jasmine-core/jasmine.css +1 -0
  11. data/lib/jasmine/lib/jasmine-core/jasmine.js +107 -36
  12. data/lib/jasmine/lib/jasmine-core/version.rb +1 -1
  13. data/lib/jasmine/spec/core/ExceptionsSpec.js +113 -87
  14. data/lib/jasmine/spec/core/MatchersSpec.js +48 -2
  15. data/lib/jasmine/spec/core/PrettyPrintSpec.js +30 -0
  16. data/lib/jasmine/spec/core/RunnerSpec.js +13 -0
  17. data/lib/jasmine/spec/core/SpecRunningSpec.js +117 -84
  18. data/lib/jasmine/spec/core/SpySpec.js +15 -0
  19. data/lib/jasmine/spec/jasmine.yml +39 -0
  20. data/lib/jasmine/spec/jasmine_self_test_spec.rb +23 -0
  21. data/lib/jasmine/spec/tasks/build_github_pages_spec.rb +14 -23
  22. data/lib/jasmine/src/core/Block.js +9 -4
  23. data/lib/jasmine/src/core/Env.js +23 -0
  24. data/lib/jasmine/src/core/Matchers.js +19 -15
  25. data/lib/jasmine/src/core/PrettyPrinter.js +11 -4
  26. data/lib/jasmine/src/core/Queue.js +23 -4
  27. data/lib/jasmine/src/core/Spec.js +4 -4
  28. data/lib/jasmine/src/core/base.js +15 -2
  29. data/lib/jasmine/src/html/HtmlReporter.js +67 -3
  30. data/lib/jasmine/src/html/ReporterView.js +3 -3
  31. data/lib/jasmine/src/html/SpecView.js +5 -5
  32. data/lib/jasmine/src/html/SuiteView.js +1 -1
  33. data/lib/jasmine/src/html/_HTMLReporter.scss +49 -42
  34. data/lib/jasmine/src/html/jasmine.css +1 -0
  35. data/lib/jasmine/src/version.js +3 -3
  36. data/lib/jasmine/src/version.json +2 -2
  37. data/lib/jasmine/tasks/jasmine_dev/build_github_pages.rb +11 -14
  38. data/lib/jasmine/tasks/jasmine_dev/build_standalone_distribution.rb +3 -2
  39. data/lib/jasmine/tasks/jasmine_dev/build_standalone_runner.rb +3 -3
  40. data/spec/runner_spec.rb +0 -2
  41. data/spec/suite_spec.rb +7 -4
  42. metadata +4 -3
@@ -1,6 +1,6 @@
1
1
  module Jasmine
2
2
  module Core
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.1"
4
4
  end
5
5
  end
6
6
 
@@ -32,118 +32,144 @@ describe('Exceptions:', function() {
32
32
  expect(jasmine.util.formatException(sampleWebkitException)).toEqual(expected);
33
33
  });
34
34
 
35
- it('should handle exceptions thrown, but continue', function() {
36
- var fakeTimer = new jasmine.FakeTimer();
37
- env.setTimeout = fakeTimer.setTimeout;
38
- env.clearTimeout = fakeTimer.clearTimeout;
39
- env.setInterval = fakeTimer.setInterval;
40
- env.clearInterval = fakeTimer.clearInterval;
41
-
42
- //we run two exception tests to make sure we continue after throwing an exception
43
- var suite = env.describe('Suite for handles exceptions', function () {
44
- env.it('should be a test that fails because it throws an exception', function() {
45
- throw new Error('fake error 1');
35
+ describe('with break on exception', function() {
36
+ it('should not catch the exception', function() {
37
+ var suite = env.describe('suite for break on exceptions', function() {
38
+ env.it('should break when an exception is thrown', function() {
39
+ throw new Error('I should hit a breakpoint!');
40
+ });
46
41
  });
42
+ var runner = env.currentRunner();
43
+ var dont_change = 'I will never change!';
44
+
45
+ var oldCatch = jasmine.CATCH_EXCEPTIONS;
46
+ jasmine.CATCH_EXCEPTIONS = false;
47
+ try {
48
+ suite.execute();
49
+ dont_change = 'oops I changed';
50
+ }
51
+ catch (e) {}
52
+ finally {
53
+ jasmine.CATCH_EXCEPTIONS = oldCatch;
54
+ }
55
+
56
+ expect(dont_change).toEqual('I will never change!');
57
+ });
58
+ });
47
59
 
48
- env.it('should be another test that fails because it throws an exception', function() {
49
- this.runs(function () {
50
- throw new Error('fake error 2');
60
+ describe("with catch on exception", function() {
61
+ it('should handle exceptions thrown, but continue', function() {
62
+ var fakeTimer = new jasmine.FakeTimer();
63
+ env.setTimeout = fakeTimer.setTimeout;
64
+ env.clearTimeout = fakeTimer.clearTimeout;
65
+ env.setInterval = fakeTimer.setInterval;
66
+ env.clearInterval = fakeTimer.clearInterval;
67
+
68
+ //we run two exception tests to make sure we continue after throwing an exception
69
+ var suite = env.describe('Suite for handles exceptions', function () {
70
+ env.it('should be a test that fails because it throws an exception', function() {
71
+ throw new Error('fake error 1');
51
72
  });
52
- this.runs(function () {
53
- this.expect(true).toEqual(true);
54
- });
55
- });
56
73
 
57
- env.it('should be a passing test that runs after exceptions are thrown', function() {
58
- this.expect(true).toEqual(true);
59
- });
74
+ env.it('should be another test that fails because it throws an exception', function() {
75
+ this.runs(function () {
76
+ throw new Error('fake error 2');
77
+ });
78
+ this.runs(function () {
79
+ this.expect(true).toEqual(true);
80
+ });
81
+ });
60
82
 
61
- env.it('should be another test that fails because it throws an exception after a wait', function() {
62
- this.runs(function () {
63
- var foo = 'foo';
83
+ env.it('should be a passing test that runs after exceptions are thrown', function() {
84
+ this.expect(true).toEqual(true);
64
85
  });
65
- this.waits(250);
66
- this.runs(function () {
67
- throw new Error('fake error 3');
86
+
87
+ env.it('should be another test that fails because it throws an exception after a wait', function() {
88
+ this.runs(function () {
89
+ var foo = 'foo';
90
+ });
91
+ this.waits(250);
92
+ this.runs(function () {
93
+ throw new Error('fake error 3');
94
+ });
68
95
  });
69
- });
70
96
 
71
- env.it('should be a passing test that runs after exceptions are thrown from a async test', function() {
72
- this.expect(true).toEqual(true);
97
+ env.it('should be a passing test that runs after exceptions are thrown from a async test', function() {
98
+ this.expect(true).toEqual(true);
99
+ });
73
100
  });
74
- });
75
-
76
- var runner = env.currentRunner();
77
- suite.execute();
78
- fakeTimer.tick(2500);
79
101
 
80
- var suiteResults = suite.results();
81
- var specResults = suiteResults.getItems();
102
+ var runner = env.currentRunner();
103
+ suite.execute();
104
+ fakeTimer.tick(2500);
82
105
 
83
- expect(suiteResults.passed()).toEqual(false);
84
- //
85
- expect(specResults.length).toEqual(5);
86
- expect(specResults[0].passed()).toMatch(false);
87
- var blockResults = specResults[0].getItems();
88
- expect(blockResults[0].passed()).toEqual(false);
89
- expect(blockResults[0].message).toMatch(/fake error 1/);
106
+ var suiteResults = suite.results();
107
+ var specResults = suiteResults.getItems();
90
108
 
91
- expect(specResults[1].passed()).toEqual(false);
92
- blockResults = specResults[1].getItems();
93
- expect(blockResults[0].passed()).toEqual(false);
94
- expect(blockResults[0].message).toMatch(/fake error 2/);
95
- expect(blockResults[1].passed()).toEqual(true);
109
+ expect(suiteResults.passed()).toEqual(false);
110
+ //
111
+ expect(specResults.length).toEqual(5);
112
+ expect(specResults[0].passed()).toMatch(false);
113
+ var blockResults = specResults[0].getItems();
114
+ expect(blockResults[0].passed()).toEqual(false);
115
+ expect(blockResults[0].message).toMatch(/fake error 1/);
96
116
 
97
- expect(specResults[2].passed()).toEqual(true);
117
+ expect(specResults[1].passed()).toEqual(false);
118
+ blockResults = specResults[1].getItems();
119
+ expect(blockResults[0].passed()).toEqual(false);
120
+ expect(blockResults[0].message).toMatch(/fake error 2/);
121
+ expect(blockResults[1].passed()).toEqual(true);
98
122
 
99
- expect(specResults[3].passed()).toEqual(false);
100
- blockResults = specResults[3].getItems();
101
- expect(blockResults[0].message).toMatch(/fake error 3/);
123
+ expect(specResults[2].passed()).toEqual(true);
102
124
 
103
- expect(specResults[4].passed()).toEqual(true);
104
- });
125
+ expect(specResults[3].passed()).toEqual(false);
126
+ blockResults = specResults[3].getItems();
127
+ expect(blockResults[0].message).toMatch(/fake error 3/);
105
128
 
129
+ expect(specResults[4].passed()).toEqual(true);
130
+ });
106
131
 
107
- it("should handle exceptions thrown directly in top-level describe blocks and continue", function () {
108
- var suite = env.describe("a top level describe block that throws an exception", function () {
109
- env.it("is a test that should pass", function () {
132
+ it("should handle exceptions thrown directly in top-level describe blocks and continue", function () {
133
+ var suite = env.describe("a top level describe block that throws an exception", function () {
134
+ env.it("is a test that should pass", function () {
110
135
  this.expect(true).toEqual(true);
111
- });
136
+ });
112
137
 
113
- throw new Error("top level error");
114
- });
138
+ throw new Error("top level error");
139
+ });
115
140
 
116
- suite.execute();
117
- var suiteResults = suite.results();
118
- var specResults = suiteResults.getItems();
141
+ suite.execute();
142
+ var suiteResults = suite.results();
143
+ var specResults = suiteResults.getItems();
119
144
 
120
- expect(suiteResults.passed()).toEqual(false);
121
- expect(specResults.length).toEqual(2);
145
+ expect(suiteResults.passed()).toEqual(false);
146
+ expect(specResults.length).toEqual(2);
122
147
 
123
- expect(specResults[1].description).toMatch(/encountered a declaration exception/);
124
- });
148
+ expect(specResults[1].description).toMatch(/encountered a declaration exception/);
149
+ });
125
150
 
126
- it("should handle exceptions thrown directly in nested describe blocks and continue", function () {
127
- var suite = env.describe("a top level describe", function () {
128
- env.describe("a mid-level describe that throws an exception", function () {
129
- env.it("is a test that should pass", function () {
130
- this.expect(true).toEqual(true);
131
- });
151
+ it("should handle exceptions thrown directly in nested describe blocks and continue", function () {
152
+ var suite = env.describe("a top level describe", function () {
153
+ env.describe("a mid-level describe that throws an exception", function () {
154
+ env.it("is a test that should pass", function () {
155
+ this.expect(true).toEqual(true);
156
+ });
132
157
 
133
- throw new Error("a mid-level error");
134
- });
135
- });
158
+ throw new Error("a mid-level error");
159
+ });
160
+ });
136
161
 
137
- suite.execute();
138
- var suiteResults = suite.results();
139
- var specResults = suiteResults.getItems();
162
+ suite.execute();
163
+ var suiteResults = suite.results();
164
+ var specResults = suiteResults.getItems();
140
165
 
141
- expect(suiteResults.passed()).toEqual(false);
142
- expect(specResults.length).toEqual(1);
166
+ expect(suiteResults.passed()).toEqual(false);
167
+ expect(specResults.length).toEqual(1);
143
168
 
144
- var nestedSpecResults = specResults[0].getItems();
169
+ var nestedSpecResults = specResults[0].getItems();
145
170
 
146
- expect(nestedSpecResults.length).toEqual(2);
147
- expect(nestedSpecResults[1].description).toMatch(/encountered a declaration exception/);
148
- });
149
- });
171
+ expect(nestedSpecResults.length).toEqual(2);
172
+ expect(nestedSpecResults[1].description).toMatch(/encountered a declaration exception/);
173
+ });
174
+ });
175
+ });
@@ -75,6 +75,18 @@ describe("jasmine.Matchers", function() {
75
75
  expect((match(parseInt('5', 10)).toEqual(5))).toPass();
76
76
  expect((match(5).toNotEqual(5))).toFail();
77
77
  expect((match(parseInt('5', 10)).toNotEqual(5))).toFail();
78
+
79
+ expect((match(/1/i).toEqual(/1/i))).toPass();
80
+ expect((match(/1/i).toNotEqual(/1/i))).toFail();
81
+ expect((match(/[abc]/gm).toEqual(/1/i))).toFail();
82
+ expect((match(/[abc]/gm).toNotEqual(/1/i))).toPass();
83
+
84
+ // only test if the browser supports the sticky option on a regExp see pull #234
85
+ if (RegExp.prototype.sticky !== undefined) {
86
+ var sticky_regexp = new RegExp("[abc]", "y");
87
+ expect((match(sticky_regexp).toEqual(/1/i))).toFail();
88
+ expect((match(sticky_regexp).toNotEqual(/1/i))).toPass();
89
+ }
78
90
  });
79
91
 
80
92
  it("toEqual to build an Expectation Result", function() {
@@ -281,6 +293,29 @@ describe("jasmine.Matchers", function() {
281
293
  expect(result.actual).toEqual(actual);
282
294
  });
283
295
 
296
+ it("toBeNaN", function() {
297
+ expect(match(Number.NaN).toBeNaN()).toPass();
298
+ expect(match(0).toBeNaN()).toFail();
299
+ expect(match(1).toBeNaN()).toFail();
300
+ expect(match(null).toBeNaN()).toFail();
301
+ expect(match(Number.POSITIVE_INFINITY).toBeNaN()).toFail();
302
+ expect(match(Number.NEGATIVE_INFINITY).toBeNaN()).toFail();
303
+ expect(match('NaN').toBeNaN()).toFail();
304
+ });
305
+
306
+ it("toBeNaN to build an ExpectationResult", function() {
307
+ var actual = 'a';
308
+ var matcher = match(actual);
309
+ matcher.toBeNaN();
310
+
311
+ var result = lastResult();
312
+
313
+ expect(result.matcherName).toEqual("toBeNaN");
314
+ expect(result.passed()).toFail();
315
+ expect(result.message).toMatch("Expected 'a' to be NaN.");
316
+ expect(result.actual).toMatch(actual);
317
+ });
318
+
284
319
  it("toBeFalsy", function() {
285
320
  expect(match(false).toBeFalsy()).toPass();
286
321
  expect(match(true).toBeFalsy()).toFail();
@@ -510,6 +545,11 @@ describe("jasmine.Matchers", function() {
510
545
  expect(-1.23).not.toBeCloseTo(-1.24);
511
546
  });
512
547
 
548
+ it("expects close numbers to 'be close' and further numbers not to", function() {
549
+ expect(1.225).not.toBeCloseTo(1.234); // difference is 0.009
550
+ expect(1.225).toBeCloseTo(1.224); // difference is 0.001
551
+ });
552
+
513
553
  it("accepts an optional precision argument", function() {
514
554
  expect(1).toBeCloseTo(1.1, 0);
515
555
  expect(1.2).toBeCloseTo(1.23, 1);
@@ -771,7 +811,13 @@ describe("jasmine.Matchers", function() {
771
811
  TestClass.spyFunction('d', 'e', 'f');
772
812
  var expected = match(TestClass.spyFunction);
773
813
  expect(expected.toHaveBeenCalledWith('a', 'b')).toFail();
774
- expect(lastResult().message).toEqual("Expected spy My spy to have been called with [ 'a', 'b' ] but was called with [ [ 'a', 'b', 'c' ], [ 'd', 'e', 'f' ] ]");
814
+ expect(lastResult().message).toEqual("Expected spy My spy to have been called with [ 'a', 'b' ] but actual calls were [ 'a', 'b', 'c' ], [ 'd', 'e', 'f' ]");
815
+ });
816
+
817
+ it("should return a decent message when it hasn't been called", function() {
818
+ var expected = match(TestClass.spyFunction);
819
+ expect(expected.toHaveBeenCalledWith('a', 'b')).toFail();
820
+ expect(lastResult().message).toEqual("Expected spy My spy to have been called with [ 'a', 'b' ] but it was never called.");
775
821
  });
776
822
 
777
823
  it("should return a decent message when inverted", function() {
@@ -779,7 +825,7 @@ describe("jasmine.Matchers", function() {
779
825
  TestClass.spyFunction('d', 'e', 'f');
780
826
  var expected = match(TestClass.spyFunction);
781
827
  expect(expected.not.toHaveBeenCalledWith('a', 'b', 'c')).toFail();
782
- expect(lastResult().message).toEqual("Expected spy My spy not to have been called with [ 'a', 'b', 'c' ] but was called with [ [ 'a', 'b', 'c' ], [ 'd', 'e', 'f' ] ]");
828
+ expect(lastResult().message).toEqual("Expected spy My spy not to have been called with [ 'a', 'b', 'c' ] but it was.");
783
829
  });
784
830
 
785
831
  it('should throw an exception when invoked on a non-spy', shouldThrowAnExceptionWhenInvokedOnANonSpy('toHaveBeenCalledWith'));
@@ -32,6 +32,36 @@ describe("jasmine.pp", function () {
32
32
  }, bar: [1, 2, 3]})).toEqual("{ foo : Function, bar : [ 1, 2, 3 ] }");
33
33
  });
34
34
 
35
+ it("should not include inherited properties when stringifying an object", function() {
36
+ var SomeClass = function() {};
37
+ SomeClass.prototype.foo = "inherited foo";
38
+ var instance = new SomeClass();
39
+ instance.bar = "my own bar";
40
+ expect(jasmine.pp(instance)).toEqual("{ bar : 'my own bar' }");
41
+ });
42
+
43
+ it("should not recurse objects and arrays more deeply than jasmine.MAX_PRETTY_PRINT_DEPTH", function() {
44
+ var originalMaxDepth = jasmine.MAX_PRETTY_PRINT_DEPTH;
45
+ var nestedObject = { level1: { level2: { level3: { level4: "leaf" } } } };
46
+ var nestedArray = [1, [2, [3, [4, "leaf"]]]];
47
+
48
+ try {
49
+ jasmine.MAX_PRETTY_PRINT_DEPTH = 2;
50
+ expect(jasmine.pp(nestedObject)).toEqual("{ level1 : { level2 : Object } }");
51
+ expect(jasmine.pp(nestedArray)).toEqual("[ 1, [ 2, Array ] ]");
52
+
53
+ jasmine.MAX_PRETTY_PRINT_DEPTH = 3;
54
+ expect(jasmine.pp(nestedObject)).toEqual("{ level1 : { level2 : { level3 : Object } } }");
55
+ expect(jasmine.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, Array ] ] ]");
56
+
57
+ jasmine.MAX_PRETTY_PRINT_DEPTH = 4;
58
+ expect(jasmine.pp(nestedObject)).toEqual("{ level1 : { level2 : { level3 : { level4 : 'leaf' } } } }");
59
+ expect(jasmine.pp(nestedArray)).toEqual("[ 1, [ 2, [ 3, [ 4, 'leaf' ] ] ] ]");
60
+ } finally {
61
+ jasmine.MAX_PRETTY_PRINT_DEPTH = originalMaxDepth;
62
+ }
63
+ });
64
+
35
65
  it("should stringify RegExp objects properly", function() {
36
66
  expect(jasmine.pp(/x|y|z/)).toEqual("/x|y|z/");
37
67
  });
@@ -105,6 +105,19 @@ describe('RunnerTest', function() {
105
105
  expect(runnerResults.totalCount).toEqual(3);
106
106
  expect(runnerResults.passedCount).toEqual(3);
107
107
  });
108
+
109
+ it('should run after a failing spec', function () {
110
+ var afterEach = jasmine.createSpy();
111
+ env.afterEach(afterEach);
112
+
113
+ env.describe('suite', function () {
114
+ env.it('fails', function () {
115
+ this.explodes();
116
+ });
117
+ }).execute();
118
+
119
+ expect(afterEach).toHaveBeenCalled();
120
+ });
108
121
  });
109
122
 
110
123
 
@@ -398,6 +398,123 @@ describe("jasmine spec running", function () {
398
398
  expect(timeoutSpec.results().getItems()[0].message).toEqual('timeout: timed out after 500 msec waiting for something to happen');
399
399
  expect(subsequentSpecRan).toEqual(true);
400
400
  });
401
+
402
+ it("runs afterEach after timing out", function() {
403
+ var afterEach = jasmine.createSpy('afterEach');
404
+
405
+ env.describe('foo', function () {
406
+ env.afterEach(afterEach);
407
+
408
+ env.it('waitsFor', function () {
409
+ this.waitsFor(100, function() {
410
+ return false;
411
+ });
412
+ });
413
+ }).execute();
414
+
415
+ fakeTimer.tick(500);
416
+ expect(afterEach).toHaveBeenCalled();
417
+ });
418
+
419
+ it("runs single-spec after functions after timing out", function() {
420
+ var after = jasmine.createSpy('after');
421
+
422
+ env.describe('foo', function () {
423
+ env.it('waitsFor', function () {
424
+ this.after(after);
425
+ this.waitsFor(100, function() {
426
+ return false;
427
+ });
428
+ });
429
+ }).execute();
430
+
431
+ fakeTimer.tick(500);
432
+ expect(after).toHaveBeenCalled();
433
+ });
434
+
435
+ describe('with consecutive calls', function () {
436
+ var foo;
437
+ beforeEach(function () {
438
+ foo = 0;
439
+ });
440
+
441
+ it('exits immediately (does not stack) if the latchFunction times out', function () {
442
+ var reachedFirstWaitsFor = false;
443
+ var reachedSecondWaitsFor = false;
444
+ env.describe('suite that waits', function () {
445
+ env.it('should stack timeouts', function() {
446
+ this.waitsFor(500, function () {
447
+ reachedFirstWaitsFor = true;
448
+ return false;
449
+ });
450
+ this.waitsFor(500, function () {
451
+ reachedSecondWaitsFor = true;
452
+ });
453
+ this.runs(function () {
454
+ foo++;
455
+ });
456
+ });
457
+ });
458
+
459
+ expect(reachedFirstWaitsFor).toEqual(false);
460
+ env.execute();
461
+
462
+ expect(reachedFirstWaitsFor).toEqual(true);
463
+ expect(foo).toEqual(0);
464
+ expect(reachedSecondWaitsFor).toEqual(false);
465
+ fakeTimer.tick(500);
466
+ expect(reachedSecondWaitsFor).toEqual(false);
467
+ expect(foo).toEqual(0);
468
+ fakeTimer.tick(500);
469
+ expect(reachedSecondWaitsFor).toEqual(false);
470
+ expect(foo).toEqual(0);
471
+ });
472
+
473
+ it('stacks latchFunctions', function () {
474
+ var firstWaitsResult = false;
475
+ var secondWaitsResult = false;
476
+ var waitsSuite = env.describe('suite that waits', function () {
477
+ env.it('spec with waitsFors', function() {
478
+ this.waitsFor(600, function () {
479
+ fakeTimer.setTimeout(function () {
480
+ firstWaitsResult = true;
481
+ }, 300);
482
+ return firstWaitsResult;
483
+ });
484
+ this.waitsFor(600, function () {
485
+ fakeTimer.setTimeout(function () {
486
+ secondWaitsResult = true;
487
+ }, 300);
488
+ return secondWaitsResult;
489
+ });
490
+ this.runs(function () {
491
+ foo++;
492
+ });
493
+ });
494
+ });
495
+
496
+ expect(firstWaitsResult).toEqual(false);
497
+ expect(secondWaitsResult).toEqual(false);
498
+ waitsSuite.execute();
499
+
500
+ expect(firstWaitsResult).toEqual(false);
501
+ expect(secondWaitsResult).toEqual(false);
502
+ expect(foo).toEqual(0);
503
+
504
+ fakeTimer.tick(300);
505
+
506
+ expect(firstWaitsResult).toEqual(true);
507
+ expect(secondWaitsResult).toEqual(false);
508
+ expect(foo).toEqual(0);
509
+
510
+ fakeTimer.tick(300);
511
+
512
+ expect(firstWaitsResult).toEqual(true);
513
+ expect(secondWaitsResult).toEqual(true);
514
+ expect(foo).toEqual(1);
515
+
516
+ });
517
+ });
401
518
  });
402
519
 
403
520
  it("testSpecAfter", function() {
@@ -579,90 +696,6 @@ describe("jasmine spec running", function () {
579
696
  expect(quux).toEqual(1);
580
697
  });
581
698
 
582
- describe('#waitsFor should allow consecutive calls', function () {
583
- var foo;
584
- beforeEach(function () {
585
- foo = 0;
586
- });
587
-
588
- it('exits immediately (does not stack) if the latchFunction times out', function () {
589
- var reachedFirstWaitsFor = false;
590
- var reachedSecondWaitsFor = false;
591
- env.describe('suite that waits', function () {
592
- env.it('should stack timeouts', function() {
593
- this.waitsFor(500, function () {
594
- reachedFirstWaitsFor = true;
595
- return false;
596
- });
597
- this.waitsFor(500, function () {
598
- reachedSecondWaitsFor = true;
599
- });
600
- this.runs(function () {
601
- foo++;
602
- });
603
- });
604
- });
605
-
606
- expect(reachedFirstWaitsFor).toEqual(false);
607
- env.execute();
608
-
609
- expect(reachedFirstWaitsFor).toEqual(true);
610
- expect(foo).toEqual(0);
611
- expect(reachedSecondWaitsFor).toEqual(false);
612
- fakeTimer.tick(500);
613
- expect(reachedSecondWaitsFor).toEqual(false);
614
- expect(foo).toEqual(0);
615
- fakeTimer.tick(500);
616
- expect(reachedSecondWaitsFor).toEqual(false);
617
- expect(foo).toEqual(0);
618
- });
619
-
620
- it('stacks latchFunctions', function () {
621
- var firstWaitsResult = false;
622
- var secondWaitsResult = false;
623
- var waitsSuite = env.describe('suite that waits', function () {
624
- env.it('spec with waitsFors', function() {
625
- this.waitsFor(600, function () {
626
- fakeTimer.setTimeout(function () {
627
- firstWaitsResult = true;
628
- }, 300);
629
- return firstWaitsResult;
630
- });
631
- this.waitsFor(600, function () {
632
- fakeTimer.setTimeout(function () {
633
- secondWaitsResult = true;
634
- }, 300);
635
- return secondWaitsResult;
636
- });
637
- this.runs(function () {
638
- foo++;
639
- });
640
- });
641
- });
642
-
643
- expect(firstWaitsResult).toEqual(false);
644
- expect(secondWaitsResult).toEqual(false);
645
- waitsSuite.execute();
646
-
647
- expect(firstWaitsResult).toEqual(false);
648
- expect(secondWaitsResult).toEqual(false);
649
- expect(foo).toEqual(0);
650
-
651
- fakeTimer.tick(300);
652
-
653
- expect(firstWaitsResult).toEqual(true);
654
- expect(secondWaitsResult).toEqual(false);
655
- expect(foo).toEqual(0);
656
-
657
- fakeTimer.tick(300);
658
-
659
- expect(firstWaitsResult).toEqual(true);
660
- expect(secondWaitsResult).toEqual(true);
661
- expect(foo).toEqual(1);
662
-
663
- });
664
- });
665
-
666
699
  it("#beforeEach should be able to eval runs and waits blocks", function () {
667
700
  var foo = 0;
668
701
  var bar = 0;