evergreen 0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/README.rdoc +101 -3
  2. data/bin/evergreen +2 -2
  3. data/lib/evergreen.rb +14 -2
  4. data/lib/evergreen/evergreen.js +23 -0
  5. data/lib/evergreen/rails.rb +8 -0
  6. data/lib/evergreen/runner.rb +21 -14
  7. data/lib/evergreen/spec.rb +12 -33
  8. data/lib/evergreen/version.rb +1 -1
  9. data/lib/evergreen/views/list.erb +1 -1
  10. data/lib/evergreen/views/spec.erb +9 -22
  11. data/lib/jasmine/README.markdown +21 -28
  12. data/lib/jasmine/Rakefile +98 -68
  13. data/lib/jasmine/example/SpecRunner.html +27 -0
  14. data/lib/jasmine/example/spec/PlayerSpec.js +58 -0
  15. data/lib/jasmine/example/spec/SpecHelper.js +9 -0
  16. data/lib/jasmine/example/src/Player.js +22 -0
  17. data/lib/jasmine/example/src/Song.js +7 -0
  18. data/lib/jasmine/lib/jasmine-html.js +182 -0
  19. data/lib/jasmine/lib/{jasmine-0.10.4.js → jasmine.js} +127 -155
  20. data/lib/jasmine/spec/runner.html +4 -3
  21. data/lib/jasmine/spec/suites/BaseSpec.js +27 -0
  22. data/lib/jasmine/spec/suites/CustomMatchersSpec.js +0 -24
  23. data/lib/jasmine/spec/suites/EnvSpec.js +1 -1
  24. data/lib/jasmine/spec/suites/JsApiReporterSpec.js +16 -9
  25. data/lib/jasmine/spec/suites/MatchersSpec.js +49 -42
  26. data/lib/jasmine/spec/suites/MockClockSpec.js +4 -0
  27. data/lib/jasmine/spec/suites/MultiReporterSpec.js +23 -8
  28. data/lib/jasmine/spec/suites/PrettyPrintSpec.js +2 -2
  29. data/lib/jasmine/spec/suites/ReporterSpec.js +10 -14
  30. data/lib/jasmine/spec/suites/RunnerSpec.js +6 -6
  31. data/lib/jasmine/spec/suites/SpecRunningSpec.js +1 -1
  32. data/lib/jasmine/spec/suites/SpecSpec.js +15 -1
  33. data/lib/jasmine/spec/suites/SpySpec.js +3 -3
  34. data/lib/jasmine/spec/suites/TrivialReporterSpec.js +91 -14
  35. data/lib/jasmine/spec/suites/WaitsForBlockSpec.js +5 -6
  36. data/lib/jasmine/src/JsApiReporter.js +4 -6
  37. data/lib/jasmine/src/Matchers.js +19 -19
  38. data/lib/jasmine/src/MultiReporter.js +8 -1
  39. data/lib/jasmine/src/NestedResults.js +5 -5
  40. data/lib/jasmine/src/PrettyPrinter.js +2 -2
  41. data/lib/jasmine/src/Reporter.js +4 -0
  42. data/lib/jasmine/src/Spec.js +12 -8
  43. data/lib/jasmine/src/base.js +40 -44
  44. data/lib/jasmine/{lib → src/html}/TrivialReporter.js +17 -6
  45. data/lib/jasmine/src/html/jasmine.css +166 -0
  46. data/lib/jasmine/src/mock-timeout.js +22 -16
  47. data/lib/jasmine/src/version.json +2 -2
  48. data/lib/tasks/evergreen.rake +7 -0
  49. data/spec/evergreen_spec.rb +18 -0
  50. data/spec/fixtures/public/jquery.js +152 -0
  51. data/spec/fixtures/spec/javascripts/bar_spec.js +0 -0
  52. data/spec/fixtures/spec/javascripts/failing_spec.js +12 -0
  53. data/spec/fixtures/spec/javascripts/foo_spec.js +0 -0
  54. data/spec/fixtures/spec/javascripts/templates_spec.html +1 -0
  55. data/spec/fixtures/spec/javascripts/templates_spec.js +23 -0
  56. data/spec/fixtures/spec/javascripts/testing_spec.js +11 -0
  57. data/spec/fixtures/spec/javascripts/transactions_spec.js +14 -0
  58. data/spec/meta_spec.rb +17 -0
  59. data/spec/runner_spec.rb +35 -0
  60. data/spec/spec_helper.rb +33 -0
  61. data/spec/spec_spec.rb +30 -0
  62. metadata +64 -48
  63. data/lib/jasmine/doc/files.html +0 -460
  64. data/lib/jasmine/doc/index.html +0 -322
  65. data/lib/jasmine/doc/symbols/_global_.html +0 -918
  66. data/lib/jasmine/doc/symbols/jasmine.Block.html +0 -417
  67. data/lib/jasmine/doc/symbols/jasmine.Clock.html +0 -678
  68. data/lib/jasmine/doc/symbols/jasmine.Env.html +0 -1169
  69. data/lib/jasmine/doc/symbols/jasmine.JsApiReporter.html +0 -822
  70. data/lib/jasmine/doc/symbols/jasmine.Matchers.html +0 -1474
  71. data/lib/jasmine/doc/symbols/jasmine.MultiReporter.html +0 -394
  72. data/lib/jasmine/doc/symbols/jasmine.NestedResults.html +0 -710
  73. data/lib/jasmine/doc/symbols/jasmine.Reporter.html +0 -574
  74. data/lib/jasmine/doc/symbols/jasmine.Runner.html +0 -710
  75. data/lib/jasmine/doc/symbols/jasmine.Spec.html +0 -1253
  76. data/lib/jasmine/doc/symbols/jasmine.Spy.html +0 -855
  77. data/lib/jasmine/doc/symbols/jasmine.Suite.html +0 -705
  78. data/lib/jasmine/doc/symbols/jasmine.html +0 -1345
  79. data/lib/jasmine/doc/symbols/jasmine.util.html +0 -535
  80. data/lib/jasmine/doc/symbols/src/lib_TrivialReporter.js.html +0 -124
  81. data/lib/jasmine/doc/symbols/src/src_Block.js.html +0 -29
  82. data/lib/jasmine/doc/symbols/src/src_Env.js.html +0 -248
  83. data/lib/jasmine/doc/symbols/src/src_JsApiReporter.js.html +0 -111
  84. data/lib/jasmine/doc/symbols/src/src_Matchers.js.html +0 -344
  85. data/lib/jasmine/doc/symbols/src/src_MultiReporter.js.html +0 -36
  86. data/lib/jasmine/doc/symbols/src/src_NestedResults.js.html +0 -88
  87. data/lib/jasmine/doc/symbols/src/src_PrettyPrinter.js.html +0 -130
  88. data/lib/jasmine/doc/symbols/src/src_Queue.js.html +0 -102
  89. data/lib/jasmine/doc/symbols/src/src_Reporter.js.html +0 -35
  90. data/lib/jasmine/doc/symbols/src/src_Reporters.js.html +0 -51
  91. data/lib/jasmine/doc/symbols/src/src_Runner.js.html +0 -75
  92. data/lib/jasmine/doc/symbols/src/src_Spec.js.html +0 -214
  93. data/lib/jasmine/doc/symbols/src/src_Suite.js.html +0 -77
  94. data/lib/jasmine/doc/symbols/src/src_WaitsBlock.js.html +0 -21
  95. data/lib/jasmine/doc/symbols/src/src_WaitsForBlock.js.html +0 -45
  96. data/lib/jasmine/doc/symbols/src/src_base.js.html +0 -585
  97. data/lib/jasmine/doc/symbols/src/src_mock-timeout.js.html +0 -185
  98. data/lib/jasmine/doc/symbols/src/src_util.js.html +0 -75
  99. data/lib/jasmine/example/example_runner.html +0 -22
  100. data/lib/jasmine/example/spec/example_suite.js +0 -11
  101. data/lib/jasmine/spec/jasmine_helper.rb +0 -44
  102. data/lib/jasmine/spec/jasmine_spec.rb +0 -31
  103. data/lib/jasmine/spec/saucelabs.yml +0 -24
  104. data/lib/jasmine/src/Reporters.js +0 -43
@@ -22,23 +22,24 @@
22
22
  <script type="text/javascript" src="../src/NestedResults.js"></script>
23
23
  <script type="text/javascript" src="../src/PrettyPrinter.js"></script>
24
24
  <script type="text/javascript" src="../src/Queue.js"></script>
25
- <script type="text/javascript" src="../src/Reporters.js"></script>
26
25
  <script type="text/javascript" src="../src/Runner.js"></script>
27
26
  <script type="text/javascript" src="../src/Spec.js"></script>
28
27
  <script type="text/javascript" src="../src/Suite.js"></script>
29
28
  <script type="text/javascript" src="../src/WaitsBlock.js"></script>
30
29
  <script type="text/javascript" src="../src/WaitsForBlock.js"></script>
31
30
 
32
- <script type="text/javascript" src="../lib/TrivialReporter.js"></script>
31
+ <script type="text/javascript" src="../src/html/TrivialReporter.js"></script>
33
32
  <script type="text/javascript" src="../lib/consolex.js"></script>
34
33
 
35
34
 
36
35
 
36
+ <script type="text/javascript" src="suites/BaseSpec.js"></script>
37
37
  <script type="text/javascript" src="suites/CustomMatchersSpec.js"></script>
38
38
  <script type="text/javascript" src="suites/EnvSpec.js"></script>
39
39
  <script type="text/javascript" src="suites/ExceptionsSpec.js"></script>
40
40
  <script type="text/javascript" src="suites/JsApiReporterSpec.js"></script>
41
41
  <script type="text/javascript" src="suites/MatchersSpec.js"></script>
42
+ <script type="text/javascript" src="suites/MockClockSpec.js"></script>
42
43
  <script type="text/javascript" src="suites/MultiReporterSpec.js"></script>
43
44
  <script type="text/javascript" src="suites/NestedResultsSpec.js"></script>
44
45
  <script type="text/javascript" src="suites/PrettyPrintSpec.js"></script>
@@ -72,7 +73,7 @@
72
73
  })();
73
74
  </script>
74
75
 
75
- <link href="../lib/jasmine.css" rel="stylesheet"/>
76
+ <link href="../src/html/jasmine.css" rel="stylesheet"/>
76
77
  </head>
77
78
 
78
79
  <body>
@@ -0,0 +1,27 @@
1
+ describe("base.js", function() {
2
+ describe("jasmine.MessageResult", function() {
3
+ it("#toString should pretty-print and concatenate each part of the message", function() {
4
+ var values = ["log", "message", 123, {key: "value"}, "FTW!"];
5
+ var messageResult = new jasmine.MessageResult(values);
6
+ expect(messageResult.toString()).toEqual("log message 123 { key : 'value' } FTW!");
7
+ });
8
+ });
9
+
10
+ describe("jasmine.log", function() {
11
+ it("should accept n arguments", function() {
12
+ spyOn(jasmine.getEnv().currentSpec, 'log');
13
+ jasmine.log(1, 2, 3);
14
+ expect(jasmine.getEnv().currentSpec.log).toHaveBeenCalledWith(1, 2, 3);
15
+ });
16
+ });
17
+
18
+ describe("jasmine.getGlobal", function() {
19
+ it("should return the global object", function() {
20
+ var globalObject = (function() {
21
+ return this;
22
+ })();
23
+
24
+ expect(jasmine.getGlobal()).toBe(globalObject);
25
+ });
26
+ });
27
+ });
@@ -85,28 +85,4 @@ describe("Custom Matchers", function() {
85
85
 
86
86
  expect(matcherCallArgs).toEqual([[], ['arg'], ['arg1', 'arg2']]);
87
87
  });
88
-
89
- describe("in the old style", function() {
90
- it("should report a deprecation error", function() {
91
- var spec;
92
- var suite = env.describe('some suite', function() {
93
- spec = env.it('spec with an expectation').runs(function () {
94
- this.addMatchers({
95
- toBeTrue: function() {
96
- this.report(this.actual === true, this.actual + " was not true.", "details");
97
- }
98
- });
99
- this.expect(true).toBeTrue();
100
- this.expect(false).toBeTrue();
101
- });
102
- });
103
-
104
- suite.execute();
105
- var passResult = new jasmine.ExpectationResult({passed: true, message: "Passed.", details: "details"});
106
- var failResult = new jasmine.ExpectationResult({passed: false, message: "false was not true.", details: "details"});
107
- failResult.trace = jasmine.any(Object);
108
- expect(spec.results().getItems()).toEqual([passResult, failResult]);
109
- });
110
- });
111
-
112
88
  });
@@ -79,7 +79,7 @@ describe("jasmine.Env", function() {
79
79
  it("should allow reporters to be registered", function() {
80
80
  env.addReporter(fakeReporter);
81
81
  env.reporter.log("message");
82
- expect(fakeReporter.log).wasCalledWith("message");
82
+ expect(fakeReporter.log).toHaveBeenCalledWith("message");
83
83
  });
84
84
  });
85
85
 
@@ -1,6 +1,4 @@
1
1
  describe('jasmine.jsApiReporter', function() {
2
-
3
-
4
2
  describe('results', function () {
5
3
  var reporter, spec1, spec2, spec3, expectedSpec1Results, expectedSpec2Results;
6
4
  var env;
@@ -35,15 +33,23 @@ describe('jasmine.jsApiReporter', function() {
35
33
  env.addReporter(reporter);
36
34
 
37
35
  env.execute();
36
+
37
+ expectedSpec1Results = {
38
+ messages: spec1.results().getItems(),
39
+ result: "passed"
40
+ };
41
+ expectedSpec2Results = {
42
+ messages: spec2.results().getItems(),
43
+ result: "failed"
44
+ };
38
45
  });
39
46
 
40
- xit('resultForSpec() should return the result for the given spec', function () {
47
+ it('resultForSpec() should return the result for the given spec', function () {
41
48
  expect(reporter.resultsForSpec(spec1.id)).toEqual(expectedSpec1Results);
42
49
  expect(reporter.resultsForSpec(spec2.id)).toEqual(expectedSpec2Results);
43
-
44
50
  });
45
51
 
46
- xit('results() should return a hash of all results, indexed by spec id', function () {
52
+ it('results() should return a hash of all results, indexed by spec id', function () {
47
53
  expect(reporter.results()[spec1.id]).toEqual(expectedSpec1Results);
48
54
  expect(reporter.results()[spec2.id]).toEqual(expectedSpec2Results);
49
55
  });
@@ -65,7 +71,7 @@ describe('jasmine.jsApiReporter', function() {
65
71
  ]);
66
72
  });
67
73
 
68
- xdescribe("#summarizeResult_", function() {
74
+ describe("#summarizeResult_", function() {
69
75
  it("should summarize a passing result", function() {
70
76
  var result = reporter.results()[spec1.id];
71
77
  var summarizedResult = reporter.summarizeResult_(result);
@@ -73,9 +79,9 @@ describe('jasmine.jsApiReporter', function() {
73
79
  expect(summarizedResult.messages.length).toEqual(1);
74
80
  expect(summarizedResult.messages[0].message).toEqual(result.messages[0].message);
75
81
  expect(summarizedResult.messages[0].passed).toBeTruthy();
76
- expect(summarizedResult.messages[0].type).toEqual('ExpectationResult');
77
- expect(summarizedResult.messages[0].text).toEqual(jasmine.undefined);
78
- expect(summarizedResult.messages[0].trace.stack).toEqual(jasmine.undefined);
82
+ expect(summarizedResult.messages[0].type).toEqual('expect');
83
+ expect(summarizedResult.messages[0].text).toBeUndefined();
84
+ expect(summarizedResult.messages[0].trace.stack).toBeUndefined();
79
85
  });
80
86
 
81
87
  it("should have a stack trace for failing specs", function() {
@@ -89,6 +95,7 @@ describe('jasmine.jsApiReporter', function() {
89
95
  var result = reporter.results()[spec3.id];
90
96
  var summarizedResult = reporter.summarizeResult_(result);
91
97
  expect(summarizedResult.result).toEqual('passed');
98
+ expect(summarizedResult.messages[0].type).toEqual('log');
92
99
  expect(summarizedResult.messages[0].text).toEqual('some debug message');
93
100
  });
94
101
  });
@@ -15,12 +15,12 @@ describe("jasmine.Matchers", function() {
15
15
  function match(value) {
16
16
  return spec.expect(value);
17
17
  }
18
-
18
+
19
19
  function lastResult() {
20
20
  return spec.addMatcherResult.mostRecentCall.args[0];
21
21
  }
22
22
 
23
- it("toEqual with primitives, objects, dates, html nodes, etc.", function() {
23
+ it("toEqual with primitives, objects, dates, etc.", function() {
24
24
  expect(match(true).toEqual(true)).toEqual(true);
25
25
 
26
26
  expect(match({foo:'bar'}).toEqual(null)).toEqual(false);
@@ -40,11 +40,6 @@ describe("jasmine.Matchers", function() {
40
40
  circularGraph.referenceToSelf = circularGraph;
41
41
  expect((match(circularGraph).toEqual(circularGraph))).toEqual(true);
42
42
 
43
- var nodeA = document.createElement('div');
44
- var nodeB = document.createElement('div');
45
- expect((match(nodeA).toEqual(nodeA))).toEqual(true);
46
- expect((match(nodeA).toEqual(nodeB))).toEqual(false);
47
-
48
43
  expect((match(new Date(2008, 1, 3, 15, 17, 19, 1234)).toEqual(new Date(2009, 1, 3, 15, 17, 19, 1234)))).toEqual(false);
49
44
  expect((match(new Date(2008, 1, 3, 15, 17, 19, 1234)).toEqual(new Date(2008, 1, 3, 15, 17, 19, 1234)))).toEqual(true);
50
45
 
@@ -64,6 +59,13 @@ describe("jasmine.Matchers", function() {
64
59
  expect((match(new Number('5')).toNotEqual(5))).toBe(false);
65
60
  });
66
61
 
62
+ it("toEqual with DOM nodes", function() {
63
+ var nodeA = document.createElement('div');
64
+ var nodeB = document.createElement('div');
65
+ expect((match(nodeA).toEqual(nodeA))).toEqual(true);
66
+ expect((match(nodeA).toEqual(nodeB))).toEqual(false);
67
+ });
68
+
67
69
  it("toEqual to build an Expectation Result", function() {
68
70
  var actual = 'a';
69
71
  var matcher = match(actual);
@@ -521,22 +523,6 @@ describe("jasmine.Matchers", function() {
521
523
  match(false).not.custom();
522
524
  expect(lastResult().message).toEqual("Passed.");
523
525
  });
524
-
525
- it("should make old-style custom matchers blow up, but only when negated", function() {
526
- spec.addMatchers({
527
- custom: function() {
528
- this.report();
529
- }
530
- });
531
-
532
- expect(function() {
533
- match(true).custom();
534
- }).not.toThrow();
535
-
536
- expect(function() {
537
- match(true).not.custom();
538
- }).toThrow();
539
- });
540
526
  });
541
527
 
542
528
  describe("spy matchers >>", function() {
@@ -569,23 +555,34 @@ describe("jasmine.Matchers", function() {
569
555
  };
570
556
  }
571
557
 
572
- describe("wasCalled", function() {
573
- it("should pass iff the spy was called", function() {
574
- expect(match(TestClass.spyFunction).wasCalled()).toEqual(false);
558
+ describe("toHaveBeenCalled", function() {
559
+ it("should pass if the spy was called", function() {
560
+ expect(match(TestClass.spyFunction).toHaveBeenCalled()).toEqual(false);
575
561
 
576
562
  TestClass.spyFunction();
577
- expect(match(TestClass.spyFunction).wasCalled()).toEqual(true);
563
+ expect(match(TestClass.spyFunction).toHaveBeenCalled()).toEqual(true);
578
564
  });
579
565
 
580
566
  it("should throw an exception when invoked with any arguments", function() {
581
567
  expect(function() {
582
- match(TestClass.normalFunction).wasCalled("unwanted argument");
583
- }).toThrow('wasCalled does not take arguments, use wasCalledWith');
568
+ match(TestClass.normalFunction).toHaveBeenCalled("unwanted argument");
569
+ }).toThrow('toHaveBeenCalled does not take arguments, use toHaveBeenCalledWith');
584
570
  });
585
571
 
586
- it('should throw an exception when invoked on a non-spy', shouldThrowAnExceptionWhenInvokedOnANonSpy('wasCalled'));
572
+ it('should throw an exception when invoked on a non-spy', shouldThrowAnExceptionWhenInvokedOnANonSpy('toHaveBeenCalled'));
573
+ });
574
+
575
+ describe("wasCalled", function() {
576
+ it("should alias toHaveBeenCalled", function() {
577
+ spyOn(TestClass, 'normalFunction');
578
+
579
+ TestClass.normalFunction();
580
+
581
+ expect(TestClass.normalFunction).wasCalled();
582
+ });
587
583
  });
588
584
 
585
+
589
586
  describe("wasNotCalled", function() {
590
587
  it("should pass iff the spy was not called", function() {
591
588
  expect(match(TestClass.spyFunction).wasNotCalled()).toEqual(true);
@@ -603,16 +600,16 @@ describe("jasmine.Matchers", function() {
603
600
  it('should throw an exception when invoked on a non-spy', shouldThrowAnExceptionWhenInvokedOnANonSpy('wasNotCalled'));
604
601
  });
605
602
 
606
- describe("wasCalledWith", function() {
607
- it('wasCalledWith should return true if it was called with the expected args', function() {
603
+ describe("toHaveBeenCalledWith", function() {
604
+ it('toHaveBeenCalledWith should return true if it was called with the expected args', function() {
608
605
  TestClass.spyFunction('a', 'b', 'c');
609
- expect(match(TestClass.spyFunction).wasCalledWith('a', 'b', 'c')).toEqual(true);
606
+ expect(match(TestClass.spyFunction).toHaveBeenCalledWith('a', 'b', 'c')).toEqual(true);
610
607
  });
611
608
 
612
609
  it('should return false if it was not called with the expected args', function() {
613
610
  TestClass.spyFunction('a', 'b', 'c');
614
611
  var expected = match(TestClass.spyFunction);
615
- expect(expected.wasCalledWith('c', 'b', 'a')).toEqual(false);
612
+ expect(expected.toHaveBeenCalledWith('c', 'b', 'a')).toEqual(false);
616
613
  var result = lastResult();
617
614
  expect(result.passed()).toEqual(false);
618
615
  expect(result.expected).toEqual(['c', 'b', 'a']);
@@ -623,7 +620,7 @@ describe("jasmine.Matchers", function() {
623
620
 
624
621
  it('should return false if it was not called', function() {
625
622
  var expected = match(TestClass.spyFunction);
626
- expect(expected.wasCalledWith('c', 'b', 'a')).toEqual(false);
623
+ expect(expected.toHaveBeenCalledWith('c', 'b', 'a')).toEqual(false);
627
624
  var result = lastResult();
628
625
  expect(result.passed()).toEqual(false);
629
626
  expect(result.expected).toEqual(['c', 'b', 'a']);
@@ -635,12 +632,12 @@ describe("jasmine.Matchers", function() {
635
632
  var expected = match(TestClass.spyFunction);
636
633
  TestClass.spyFunction('a', 'b', 'c');
637
634
  TestClass.spyFunction('d', 'e', 'f');
638
- expect(expected.wasCalledWith('a', 'b', 'c')).toEqual(true);
639
- expect(expected.wasCalledWith('d', 'e', 'f')).toEqual(true);
640
- expect(expected.wasCalledWith('x', 'y', 'z')).toEqual(false);
635
+ expect(expected.toHaveBeenCalledWith('a', 'b', 'c')).toEqual(true);
636
+ expect(expected.toHaveBeenCalledWith('d', 'e', 'f')).toEqual(true);
637
+ expect(expected.toHaveBeenCalledWith('x', 'y', 'z')).toEqual(false);
641
638
  });
642
639
 
643
- it('should throw an exception when invoked on a non-spy', shouldThrowAnExceptionWhenInvokedOnANonSpy('wasCalledWith'));
640
+ it('should throw an exception when invoked on a non-spy', shouldThrowAnExceptionWhenInvokedOnANonSpy('toHaveBeenCalledWith'));
644
641
 
645
642
  describe("to build an ExpectationResult", function () {
646
643
  beforeEach(function() {
@@ -657,10 +654,10 @@ describe("jasmine.Matchers", function() {
657
654
  it("should should handle the case of a spy", function() {
658
655
  TestClass.someFunction('a', 'c');
659
656
  var matcher = match(TestClass.someFunction);
660
- matcher.wasCalledWith('a', 'b');
657
+ matcher.toHaveBeenCalledWith('a', 'b');
661
658
 
662
659
  var result = lastResult();
663
- expect(result.matcherName).toEqual("wasCalledWith");
660
+ expect(result.matcherName).toEqual("toHaveBeenCalledWith");
664
661
  expect(result.passed()).toEqual(false);
665
662
  expect(result.message).toContain(jasmine.pp(['a', 'b']));
666
663
  expect(result.message).toContain(jasmine.pp(['a', 'c']));
@@ -670,6 +667,16 @@ describe("jasmine.Matchers", function() {
670
667
  });
671
668
  });
672
669
 
670
+ describe("wasCalledWith", function() {
671
+ it("should alias toHaveBeenCalledWith", function() {
672
+ spyOn(TestClass, 'normalFunction');
673
+
674
+ TestClass.normalFunction(123);
675
+
676
+ expect(TestClass.normalFunction).wasCalledWith(123);
677
+ });
678
+ });
679
+
673
680
  describe("wasNotCalledWith", function() {
674
681
  it('should return true if the spy was NOT called with the expected args', function() {
675
682
  TestClass.spyFunction('a', 'b', 'c');
@@ -690,7 +697,7 @@ describe("jasmine.Matchers", function() {
690
697
  it('should return true if it was not called', function() {
691
698
  var expected = match(TestClass.spyFunction);
692
699
  expect(expected.wasNotCalledWith('c', 'b', 'a')).toEqual(true);
693
- });
700
+ });
694
701
 
695
702
  it('should allow matches across multiple calls', function() {
696
703
  var expected = match(TestClass.spyFunction);
@@ -31,4 +31,8 @@ describe("MockClock", function () {
31
31
  expect(interval).toEqual(2);
32
32
  });
33
33
  });
34
+
35
+ it("shouldn't complain if you call jasmine.Clock.useMock() more than once", function() {
36
+ jasmine.Clock.useMock();
37
+ });
34
38
  });
@@ -10,21 +10,36 @@ describe("jasmine.MultiReporter", function() {
10
10
  });
11
11
 
12
12
  it("should support all the method calls that jasmine.Reporter supports", function() {
13
- multiReporter.reportRunnerStarting();
14
- multiReporter.reportRunnerResults();
15
- multiReporter.reportSuiteResults();
16
- multiReporter.reportSpecResults();
17
- multiReporter.log();
13
+ var delegate = {};
14
+ multiReporter.addReporter(delegate);
15
+
16
+ this.addMatchers({
17
+ toDelegateMethod: function(methodName) {
18
+ delegate[methodName] = jasmine.createSpy(methodName);
19
+ this.actual[methodName]("whatever argument");
20
+
21
+ return delegate[methodName].wasCalled
22
+ && delegate[methodName].mostRecentCall.args.length == 1
23
+ && delegate[methodName].mostRecentCall.args[0] == "whatever argument";
24
+ }
25
+ });
26
+
27
+ expect(multiReporter).toDelegateMethod('reportRunnerStarting');
28
+ expect(multiReporter).toDelegateMethod('reportRunnerResults');
29
+ expect(multiReporter).toDelegateMethod('reportSuiteResults');
30
+ expect(multiReporter).toDelegateMethod('reportSpecStarting');
31
+ expect(multiReporter).toDelegateMethod('reportSpecResults');
32
+ expect(multiReporter).toDelegateMethod('log');
18
33
  });
19
34
 
20
35
  it("should delegate to any and all subreporters", function() {
21
36
  multiReporter.reportSpecResults('blah', 'foo');
22
- expect(fakeReporter1.reportSpecResults).wasCalledWith('blah', 'foo');
23
- expect(fakeReporter2.reportSpecResults).wasCalledWith('blah', 'foo');
37
+ expect(fakeReporter1.reportSpecResults).toHaveBeenCalledWith('blah', 'foo');
38
+ expect(fakeReporter2.reportSpecResults).toHaveBeenCalledWith('blah', 'foo');
24
39
  });
25
40
 
26
41
  it("should quietly skip delegating to any subreporters which lack the given method", function() {
27
42
  multiReporter.reportRunnerStarting('blah', 'foo');
28
- expect(fakeReporter2.reportRunnerStarting).wasCalledWith('blah', 'foo');
43
+ expect(fakeReporter2.reportRunnerStarting).toHaveBeenCalledWith('blah', 'foo');
29
44
  });
30
45
  });
@@ -69,8 +69,8 @@ describe("jasmine.pp", function () {
69
69
  expect(jasmine.pp('some <b>html string</b> &', false)).toEqual('\'some <b>html string</b> &\'');
70
70
  });
71
71
 
72
- it("should abbreviate window objects", function() {
73
- expect(jasmine.pp(window)).toEqual("<window>");
72
+ it("should abbreviate the global (usually window) object", function() {
73
+ expect(jasmine.pp(jasmine.getGlobal())).toEqual("<global>");
74
74
  });
75
75
 
76
76
  it("should stringify Date objects properly", function() {
@@ -33,20 +33,16 @@ describe('jasmine.Reporter', function() {
33
33
  var bar = 0;
34
34
  var baz = 0;
35
35
 
36
- var specCallback = function (results) {
37
- foo++;
38
- };
39
- var suiteCallback = function (results) {
40
- bar++;
41
- };
42
- var runnerCallback = function (results) {
43
- baz++;
44
- };
45
-
46
- env.reporter = jasmine.Reporters.reporter({
47
- specCallback: specCallback,
48
- suiteCallback: suiteCallback,
49
- runnerCallback: runnerCallback
36
+ env.addReporter({
37
+ reportSpecResults: function() {
38
+ foo++;
39
+ },
40
+ reportSuiteResults: function() {
41
+ bar++;
42
+ },
43
+ reportRunnerResults: function() {
44
+ baz++;
45
+ }
50
46
  });
51
47
 
52
48
  var runner = env.currentRunner();