js-test-driver-rails 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.gitignore +5 -0
  2. data/.gitmodules +6 -0
  3. data/Gemfile +2 -5
  4. data/Gemfile.lock +8 -9
  5. data/Rakefile +3 -28
  6. data/js-test-driver-rails.gemspec +25 -0
  7. data/lib/js_test_driver/version.rb +3 -0
  8. metadata +17 -183
  9. data/VERSION +0 -1
  10. data/vendor/jasmine-jstd-adapter/MIT.LICENSE +0 -22
  11. data/vendor/jasmine-jstd-adapter/README.md +0 -25
  12. data/vendor/jasmine-jstd-adapter/jsTestDriver.conf +0 -6
  13. data/vendor/jasmine-jstd-adapter/jsTestDriverIit.conf +0 -6
  14. data/vendor/jasmine-jstd-adapter/lib/jasmine/jasmine-0.11.1.js +0 -2343
  15. data/vendor/jasmine-jstd-adapter/lib/jstestdriver/JsTestDriver.jar +0 -0
  16. data/vendor/jasmine-jstd-adapter/server.sh +0 -1
  17. data/vendor/jasmine-jstd-adapter/src-test/iit/iitSpec.js +0 -46
  18. data/vendor/jasmine-jstd-adapter/src-test/tests.js +0 -89
  19. data/vendor/jasmine-jstd-adapter/src/JasmineAdapter.js +0 -186
  20. data/vendor/jasmine-jstd-adapter/test-iit.sh +0 -1
  21. data/vendor/jasmine-jstd-adapter/test-regular.sh +0 -2
  22. data/vendor/jasmine-jstd-adapter/test.sh +0 -2
  23. data/vendor/jasmine/Gemfile +0 -6
  24. data/vendor/jasmine/MIT.LICENSE +0 -20
  25. data/vendor/jasmine/README.markdown +0 -28
  26. data/vendor/jasmine/Rakefile +0 -182
  27. data/vendor/jasmine/cruise_config.rb +0 -21
  28. data/vendor/jasmine/example/SpecRunner.html +0 -27
  29. data/vendor/jasmine/example/spec/PlayerSpec.js +0 -58
  30. data/vendor/jasmine/example/spec/SpecHelper.js +0 -9
  31. data/vendor/jasmine/example/src/Player.js +0 -22
  32. data/vendor/jasmine/example/src/Song.js +0 -7
  33. data/vendor/jasmine/images/fail-16.png +0 -0
  34. data/vendor/jasmine/images/fail.png +0 -0
  35. data/vendor/jasmine/images/go-16.png +0 -0
  36. data/vendor/jasmine/images/go.png +0 -0
  37. data/vendor/jasmine/images/pending-16.png +0 -0
  38. data/vendor/jasmine/images/pending.png +0 -0
  39. data/vendor/jasmine/images/question-bk.png +0 -0
  40. data/vendor/jasmine/images/questionbk-16.png +0 -0
  41. data/vendor/jasmine/images/spinner.gif +0 -0
  42. data/vendor/jasmine/jsdoc-template/allclasses.tmpl +0 -17
  43. data/vendor/jasmine/jsdoc-template/allfiles.tmpl +0 -56
  44. data/vendor/jasmine/jsdoc-template/class.tmpl +0 -646
  45. data/vendor/jasmine/jsdoc-template/index.tmpl +0 -39
  46. data/vendor/jasmine/jsdoc-template/publish.js +0 -184
  47. data/vendor/jasmine/jsdoc-template/static/default.css +0 -162
  48. data/vendor/jasmine/jsdoc-template/static/header.html +0 -2
  49. data/vendor/jasmine/jsdoc-template/static/index.html +0 -19
  50. data/vendor/jasmine/jsdoc-template/symbol.tmpl +0 -35
  51. data/vendor/jasmine/lib/jasmine-html.js +0 -188
  52. data/vendor/jasmine/lib/jasmine.css +0 -166
  53. data/vendor/jasmine/lib/jasmine.js +0 -2421
  54. data/vendor/jasmine/lib/json2.js +0 -478
  55. data/vendor/jasmine/spec/runner.html +0 -80
  56. data/vendor/jasmine/spec/suites/BaseSpec.js +0 -27
  57. data/vendor/jasmine/spec/suites/CustomMatchersSpec.js +0 -97
  58. data/vendor/jasmine/spec/suites/EnvSpec.js +0 -158
  59. data/vendor/jasmine/spec/suites/ExceptionsSpec.js +0 -107
  60. data/vendor/jasmine/spec/suites/JsApiReporterSpec.js +0 -103
  61. data/vendor/jasmine/spec/suites/MatchersSpec.js +0 -795
  62. data/vendor/jasmine/spec/suites/MockClockSpec.js +0 -38
  63. data/vendor/jasmine/spec/suites/MultiReporterSpec.js +0 -45
  64. data/vendor/jasmine/spec/suites/NestedResultsSpec.js +0 -54
  65. data/vendor/jasmine/spec/suites/PrettyPrintSpec.js +0 -93
  66. data/vendor/jasmine/spec/suites/QueueSpec.js +0 -23
  67. data/vendor/jasmine/spec/suites/ReporterSpec.js +0 -56
  68. data/vendor/jasmine/spec/suites/RunnerSpec.js +0 -267
  69. data/vendor/jasmine/spec/suites/SpecRunningSpec.js +0 -1253
  70. data/vendor/jasmine/spec/suites/SpecSpec.js +0 -124
  71. data/vendor/jasmine/spec/suites/SpySpec.js +0 -201
  72. data/vendor/jasmine/spec/suites/SuiteSpec.js +0 -120
  73. data/vendor/jasmine/spec/suites/TrivialReporterSpec.js +0 -238
  74. data/vendor/jasmine/spec/suites/UtilSpec.js +0 -40
  75. data/vendor/jasmine/spec/suites/WaitsForBlockSpec.js +0 -87
  76. data/vendor/jasmine/src/Block.js +0 -22
  77. data/vendor/jasmine/src/Env.js +0 -264
  78. data/vendor/jasmine/src/JsApiReporter.js +0 -102
  79. data/vendor/jasmine/src/Matchers.js +0 -354
  80. data/vendor/jasmine/src/MultiReporter.js +0 -35
  81. data/vendor/jasmine/src/NestedResults.js +0 -80
  82. data/vendor/jasmine/src/PrettyPrinter.js +0 -122
  83. data/vendor/jasmine/src/Queue.js +0 -99
  84. data/vendor/jasmine/src/Reporter.js +0 -31
  85. data/vendor/jasmine/src/Runner.js +0 -77
  86. data/vendor/jasmine/src/Spec.js +0 -242
  87. data/vendor/jasmine/src/Suite.js +0 -82
  88. data/vendor/jasmine/src/WaitsBlock.js +0 -13
  89. data/vendor/jasmine/src/WaitsForBlock.js +0 -52
  90. data/vendor/jasmine/src/base.js +0 -589
  91. data/vendor/jasmine/src/html/TrivialReporter.js +0 -188
  92. data/vendor/jasmine/src/html/jasmine.css +0 -166
  93. data/vendor/jasmine/src/mock-timeout.js +0 -183
  94. data/vendor/jasmine/src/util.js +0 -67
  95. data/vendor/jasmine/src/version.json +0 -5
@@ -1,38 +0,0 @@
1
- describe("MockClock", function () {
2
-
3
- beforeEach(function() {
4
- jasmine.Clock.useMock();
5
- });
6
-
7
- describe("setTimeout", function () {
8
- it("should mock the clock when useMock is in a beforeEach", function() {
9
- var expected = false;
10
- setTimeout(function() {
11
- expected = true;
12
- }, 30000);
13
- expect(expected).toBe(false);
14
- jasmine.Clock.tick(30001);
15
- expect(expected).toBe(true);
16
- });
17
- });
18
-
19
- describe("setInterval", function () {
20
- it("should mock the clock when useMock is in a beforeEach", function() {
21
- var interval = 0;
22
- setInterval(function() {
23
- interval++;
24
- }, 30000);
25
- expect(interval).toEqual(0);
26
- jasmine.Clock.tick(30001);
27
- expect(interval).toEqual(1);
28
- jasmine.Clock.tick(30001);
29
- expect(interval).toEqual(2);
30
- jasmine.Clock.tick(1);
31
- expect(interval).toEqual(2);
32
- });
33
- });
34
-
35
- it("shouldn't complain if you call jasmine.Clock.useMock() more than once", function() {
36
- jasmine.Clock.useMock();
37
- });
38
- });
@@ -1,45 +0,0 @@
1
- describe("jasmine.MultiReporter", function() {
2
- var multiReporter, fakeReporter1, fakeReporter2;
3
-
4
- beforeEach(function() {
5
- multiReporter = new jasmine.MultiReporter();
6
- fakeReporter1 = jasmine.createSpyObj("fakeReporter1", ["reportSpecResults"]);
7
- fakeReporter2 = jasmine.createSpyObj("fakeReporter2", ["reportSpecResults", "reportRunnerStarting"]);
8
- multiReporter.addReporter(fakeReporter1);
9
- multiReporter.addReporter(fakeReporter2);
10
- });
11
-
12
- it("should support all the method calls that jasmine.Reporter supports", function() {
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');
33
- });
34
-
35
- it("should delegate to any and all subreporters", function() {
36
- multiReporter.reportSpecResults('blah', 'foo');
37
- expect(fakeReporter1.reportSpecResults).toHaveBeenCalledWith('blah', 'foo');
38
- expect(fakeReporter2.reportSpecResults).toHaveBeenCalledWith('blah', 'foo');
39
- });
40
-
41
- it("should quietly skip delegating to any subreporters which lack the given method", function() {
42
- multiReporter.reportRunnerStarting('blah', 'foo');
43
- expect(fakeReporter2.reportRunnerStarting).toHaveBeenCalledWith('blah', 'foo');
44
- });
45
- });
@@ -1,54 +0,0 @@
1
- describe('jasmine.NestedResults', function() {
2
- it('#addResult increments counters', function() {
3
- // Leaf case
4
- var results = new jasmine.NestedResults();
5
-
6
- results.addResult(new jasmine.ExpectationResult({
7
- matcherName: "foo", passed: true, message: 'Passed.', actual: 'bar', expected: 'bar'}
8
- ));
9
-
10
- expect(results.getItems().length).toEqual(1);
11
- expect(results.totalCount).toEqual(1);
12
- expect(results.passedCount).toEqual(1);
13
- expect(results.failedCount).toEqual(0);
14
-
15
- results.addResult(new jasmine.ExpectationResult({
16
- matcherName: "baz", passed: false, message: 'FAIL.', actual: "corge", expected: "quux"
17
- }));
18
-
19
- expect(results.getItems().length).toEqual(2);
20
- expect(results.totalCount).toEqual(2);
21
- expect(results.passedCount).toEqual(1);
22
- expect(results.failedCount).toEqual(1);
23
- });
24
-
25
- it('should roll up counts for nested results', function() {
26
- // Branch case
27
- var leafResultsOne = new jasmine.NestedResults();
28
- leafResultsOne.addResult(new jasmine.ExpectationResult({
29
- matcherName: "toSomething", passed: true, message: 'message', actual: '', expected:''
30
- }));
31
-
32
- leafResultsOne.addResult(new jasmine.ExpectationResult({
33
- matcherName: "toSomethingElse", passed: false, message: 'message', actual: 'a', expected: 'b'
34
- }));
35
-
36
- var leafResultsTwo = new jasmine.NestedResults();
37
- leafResultsTwo.addResult(new jasmine.ExpectationResult({
38
- matcherName: "toSomething", passed: true, message: 'message', actual: '', expected: ''
39
- }));
40
- leafResultsTwo.addResult(new jasmine.ExpectationResult({
41
- matcherName: "toSomethineElse", passed: false, message: 'message', actual: 'c', expected: 'd'
42
- }));
43
-
44
- var branchResults = new jasmine.NestedResults();
45
- branchResults.addResult(leafResultsOne);
46
- branchResults.addResult(leafResultsTwo);
47
-
48
- expect(branchResults.getItems().length).toEqual(2);
49
- expect(branchResults.totalCount).toEqual(4);
50
- expect(branchResults.passedCount).toEqual(2);
51
- expect(branchResults.failedCount).toEqual(2);
52
- });
53
-
54
- });
@@ -1,93 +0,0 @@
1
- describe("jasmine.pp", function () {
2
- it("should wrap strings in single quotes", function() {
3
- expect(jasmine.pp("some string")).toEqual("'some string'");
4
- expect(jasmine.pp("som' string")).toEqual("'som' string'");
5
- });
6
-
7
- it("should stringify primitives properly", function() {
8
- expect(jasmine.pp(true)).toEqual("true");
9
- expect(jasmine.pp(false)).toEqual("false");
10
- expect(jasmine.pp(null)).toEqual("null");
11
- expect(jasmine.pp(jasmine.undefined)).toEqual("undefined");
12
- expect(jasmine.pp(3)).toEqual("3");
13
- expect(jasmine.pp(-3.14)).toEqual("-3.14");
14
- });
15
-
16
- it("should stringify arrays properly", function() {
17
- expect(jasmine.pp([1, 2])).toEqual("[ 1, 2 ]");
18
- expect(jasmine.pp([1, 'foo', {}, jasmine.undefined, null])).toEqual("[ 1, 'foo', { }, undefined, null ]");
19
- });
20
-
21
- it("should indicate circular array references", function() {
22
- var array1 = [1, 2];
23
- var array2 = [array1];
24
- array1.push(array2);
25
- expect(jasmine.pp(array1)).toEqual("[ 1, 2, [ <circular reference: Array> ] ]");
26
- });
27
-
28
- it("should stringify objects properly", function() {
29
- expect(jasmine.pp({foo: 'bar'})).toEqual("{ foo : 'bar' }");
30
- expect(jasmine.pp({foo:'bar', baz:3, nullValue: null, undefinedValue: jasmine.undefined})).toEqual("{ foo : 'bar', baz : 3, nullValue : null, undefinedValue : undefined }");
31
- expect(jasmine.pp({foo: function () {
32
- }, bar: [1, 2, 3]})).toEqual("{ foo : Function, bar : [ 1, 2, 3 ] }");
33
- });
34
-
35
- it("should stringify RegExp objects properly", function() {
36
- expect(jasmine.pp(/x|y|z/)).toEqual("/x|y|z/");
37
- });
38
-
39
- it("should indicate circular object references", function() {
40
- var sampleValue = {foo: 'hello'};
41
- sampleValue.nested = sampleValue;
42
- expect(jasmine.pp(sampleValue)).toEqual("{ foo : 'hello', nested : <circular reference: Object> }");
43
- });
44
-
45
- it("should indicate getters on objects as such", function() {
46
- var sampleValue = {id: 1};
47
- if (sampleValue.__defineGetter__) {
48
- //not supported in IE!
49
- sampleValue.__defineGetter__('calculatedValue', function() {
50
- throw new Error("don't call me!");
51
- });
52
- }
53
- if (sampleValue.__defineGetter__) {
54
- expect(jasmine.pp(sampleValue)).toEqual("{ id : 1, calculatedValue : <getter> }");
55
- }
56
- else {
57
- expect(jasmine.pp(sampleValue)).toEqual("{ id : 1 }");
58
- }
59
- });
60
-
61
- it("should stringify HTML nodes properly", function() {
62
- var sampleNode = document.createElement('div');
63
- sampleNode.innerHTML = 'foo<b>bar</b>';
64
- expect(jasmine.pp(sampleNode)).toEqual("HTMLNode");
65
- expect(jasmine.pp({foo: sampleNode})).toEqual("{ foo : HTMLNode }");
66
- });
67
-
68
- it('should not do HTML escaping of strings', function() {
69
- expect(jasmine.pp('some <b>html string</b> &', false)).toEqual('\'some <b>html string</b> &\'');
70
- });
71
-
72
- it("should abbreviate the global (usually window) object", function() {
73
- expect(jasmine.pp(jasmine.getGlobal())).toEqual("<global>");
74
- });
75
-
76
- it("should stringify Date objects properly", function() {
77
- var now = new Date();
78
- expect(jasmine.pp(now)).toEqual("Date(" + now.toString() + ")");
79
- });
80
-
81
- it("should stringify spy objects properly", function() {
82
- var TestObject = {
83
- someFunction: function() {
84
- }
85
- };
86
- spyOn(TestObject, 'someFunction');
87
- expect(jasmine.pp(TestObject.someFunction)).toEqual("spy on someFunction");
88
-
89
- expect(jasmine.pp(jasmine.createSpy("something"))).toEqual("spy on something");
90
- });
91
-
92
- });
93
-
@@ -1,23 +0,0 @@
1
- describe("jasmine.Queue", function() {
2
- it("should not call itself recursively, so we don't get stack overflow errors", function() {
3
- var queue = new jasmine.Queue(new jasmine.Env());
4
- queue.add(new jasmine.Block(null, function() {}));
5
- queue.add(new jasmine.Block(null, function() {}));
6
- queue.add(new jasmine.Block(null, function() {}));
7
- queue.add(new jasmine.Block(null, function() {}));
8
-
9
- var nestCount = 0;
10
- var maxNestCount = 0;
11
- var nextCallCount = 0;
12
- queue.next_ = function() {
13
- nestCount++;
14
- if (nestCount > maxNestCount) maxNestCount = nestCount;
15
-
16
- jasmine.Queue.prototype.next_.apply(queue, arguments);
17
- nestCount--;
18
- };
19
-
20
- queue.start();
21
- expect(maxNestCount).toEqual(1);
22
- });
23
- });
@@ -1,56 +0,0 @@
1
- describe('jasmine.Reporter', function() {
2
- var env;
3
-
4
-
5
- beforeEach(function() {
6
- env = new jasmine.Env();
7
- env.updateInterval = 0;
8
- });
9
-
10
- it('should get called from the test runner', function() {
11
- env.describe('Suite for JSON Reporter with Callbacks', function () {
12
- env.it('should be a test', function() {
13
- this.runs(function () {
14
- this.expect(true).toEqual(true);
15
- });
16
- });
17
- env.it('should be a failing test', function() {
18
- this.runs(function () {
19
- this.expect(false).toEqual(true);
20
- });
21
- });
22
- });
23
- env.describe('Suite for JSON Reporter with Callbacks 2', function () {
24
- env.it('should be a test', function() {
25
- this.runs(function () {
26
- this.expect(true).toEqual(true);
27
- });
28
- });
29
-
30
- });
31
-
32
- var foo = 0;
33
- var bar = 0;
34
- var baz = 0;
35
-
36
- env.addReporter({
37
- reportSpecResults: function() {
38
- foo++;
39
- },
40
- reportSuiteResults: function() {
41
- bar++;
42
- },
43
- reportRunnerResults: function() {
44
- baz++;
45
- }
46
- });
47
-
48
- var runner = env.currentRunner();
49
- runner.execute();
50
-
51
- expect(foo).toEqual(3); // 'foo was expected to be 3, was ' + foo);
52
- expect(bar).toEqual(2); // 'bar was expected to be 2, was ' + bar);
53
- expect(baz).toEqual(1); // 'baz was expected to be 1, was ' + baz);
54
- });
55
-
56
- });
@@ -1,267 +0,0 @@
1
- describe('RunnerTest', function() {
2
- var fakeTimer;
3
- var env;
4
-
5
- beforeEach(function() {
6
- env = new jasmine.Env();
7
- env.updateInterval = 0;
8
-
9
- fakeTimer = new jasmine.FakeTimer();
10
- env.setTimeout = fakeTimer.setTimeout;
11
- env.clearTimeout = fakeTimer.clearTimeout;
12
- env.setInterval = fakeTimer.setInterval;
13
- env.clearInterval = fakeTimer.clearInterval;
14
- });
15
-
16
- describe('beforeEach', function() {
17
- it('should run before each spec for all suites', function () {
18
- var foo;
19
- env.beforeEach(function () {
20
- foo = 0;
21
- });
22
-
23
- env.describe('suite 1', function () {
24
- env.it('test 1-1', function() {
25
- foo++;
26
- this.expect(foo).toEqual(1);
27
- });
28
- env.it('test 1-2', function() {
29
- foo++;
30
- this.expect(foo).toEqual(1);
31
- });
32
- });
33
-
34
- env.describe('suite 2', function () {
35
- env.it('test 2-1', function() {
36
- foo++;
37
- this.expect(foo).toEqual(1);
38
- });
39
- });
40
-
41
- env.currentRunner().execute();
42
-
43
- var runnerResults = env.currentRunner().results();
44
- expect(runnerResults.totalCount).toEqual(3);
45
- expect(runnerResults.passedCount).toEqual(3);
46
- });
47
-
48
-
49
- it('should provide all specs', function () {
50
- var foo;
51
- env.beforeEach(function () {
52
- foo = 0;
53
- });
54
-
55
- env.describe('suite 1', function () {
56
- env.it('test 1-1', function() {
57
- foo++;
58
- this.expect(foo).toEqual(1);
59
- });
60
- env.it('test 1-2', function() {
61
- foo++;
62
- this.expect(foo).toEqual(1);
63
- });
64
- });
65
-
66
- env.describe('suite 2', function () {
67
- env.it('test 2-1', function() {
68
- foo++;
69
- this.expect(foo).toEqual(1);
70
- });
71
- });
72
-
73
- env.currentRunner().execute();
74
-
75
-
76
- expect(env.currentRunner().specs().length).toEqual(3);
77
- });
78
- });
79
-
80
- describe('afterEach', function() {
81
- it('should run after each spec for all suites', function () {
82
- var foo = 3;
83
- env.afterEach(function () {
84
- foo = foo - 1;
85
- });
86
-
87
- env.describe('suite 1', function () {
88
- env.it('test 1-1', function() {
89
- this.expect(foo).toEqual(3);
90
- });
91
- env.it('test 1-2', function() {
92
- this.expect(foo).toEqual(2);
93
- });
94
- });
95
-
96
- env.describe('suite 2', function () {
97
- env.it('test 2-1', function() {
98
- this.expect(foo).toEqual(1);
99
- });
100
- });
101
-
102
- env.currentRunner().execute();
103
-
104
- var runnerResults = env.currentRunner().results();
105
- expect(runnerResults.totalCount).toEqual(3);
106
- expect(runnerResults.passedCount).toEqual(3);
107
- });
108
- });
109
-
110
-
111
- it('should run child suites and specs and generate results when execute is called', function() {
112
- env.describe('one suite description', function () {
113
- env.it('should be a test', function() {
114
- this.runs(function () {
115
- this.expect(true).toEqual(true);
116
- });
117
- });
118
- });
119
-
120
- env.describe('another suite description', function () {
121
- env.it('should be another test', function() {
122
- this.runs(function () {
123
- this.expect(true).toEqual(false);
124
- });
125
- });
126
- });
127
-
128
- env.currentRunner().execute();
129
-
130
- var runnerResults = env.currentRunner().results();
131
- expect(runnerResults.totalCount).toEqual(2);
132
- expect(runnerResults.passedCount).toEqual(1);
133
- expect(runnerResults.failedCount).toEqual(1);
134
- });
135
-
136
-
137
- it('should ignore suites that have been x\'d', function() {
138
- env.xdescribe('one suite description', function () {
139
- env.it('should be a test', function() {
140
- this.runs(function () {
141
- this.expect(true).toEqual(true);
142
- });
143
- });
144
- });
145
-
146
- env.describe('another suite description', function () {
147
- env.it('should be another test', function() {
148
- this.runs(function () {
149
- this.expect(true).toEqual(false);
150
- });
151
- });
152
- });
153
-
154
- env.currentRunner().execute();
155
-
156
- var runnerResults = env.currentRunner().results();
157
- expect(runnerResults.totalCount).toEqual(1);
158
- expect(runnerResults.passedCount).toEqual(0);
159
- expect(runnerResults.failedCount).toEqual(1);
160
- });
161
-
162
- it('should roll up results from all specs', function() {
163
- env.describe('one suite description', function () {
164
- env.it('should be a test', function() {
165
- this.runs(function () {
166
- this.expect(true).toEqual(true);
167
- });
168
- });
169
- });
170
-
171
- env.describe('another suite description', function () {
172
- env.it('should be another test', function() {
173
- this.runs(function () {
174
- this.expect(true).toEqual(false);
175
- });
176
- });
177
- });
178
-
179
- env.currentRunner().execute();
180
-
181
- var results = env.currentRunner().results();
182
- expect(results.totalCount).toEqual(2);
183
- expect(results.passedCount).toEqual(1);
184
- expect(results.failedCount).toEqual(1);
185
- });
186
-
187
- describe('reporting', function () {
188
- var fakeReporter;
189
- beforeEach(function () {
190
- fakeReporter = jasmine.createSpyObj("fakeReporter", ["log", "reportRunnerStarting", "reportRunnerResults"]);
191
- env.addReporter(fakeReporter);
192
- });
193
-
194
- it('should report runner results when the runner has completed running', function() {
195
- env.describe('one suite description', function () {
196
- env.it('should be a test', function() {
197
- this.runs(function () {
198
- this.expect(true).toEqual(true);
199
- });
200
- });
201
- });
202
-
203
- env.describe('another suite description', function () {
204
- env.it('should be another test', function() {
205
- this.waits(200);
206
- this.runs(function () {
207
- this.expect(true).toEqual(false);
208
- });
209
- });
210
- });
211
-
212
- env.currentRunner().execute();
213
- expect(fakeReporter.reportRunnerResults).not.toHaveBeenCalled();
214
- fakeTimer.tick(200);
215
- //This blows up the JSApiReporter.
216
- //expect(fakeReporter.reportRunnerResults).toHaveBeenCalledWith(env.currentRunner);
217
- expect(fakeReporter.reportRunnerResults).toHaveBeenCalled();
218
- expect(fakeReporter.reportRunnerResults.mostRecentCall.args[0].results()).toEqual(env.currentRunner().results());
219
- });
220
- });
221
-
222
- it("should report when the tests start running", function() {
223
- var fakeReporter = jasmine.createSpyObj("fakeReporter", ["log", "reportRunnerStarting"]);
224
- env.addReporter(fakeReporter);
225
-
226
-
227
- var runner = new jasmine.Runner(env);
228
- runner.arbitraryVariable = 'foo';
229
- spyOn(runner.queue, 'start');
230
- expect(fakeReporter.reportRunnerStarting).not.toHaveBeenCalled();
231
- runner.execute();
232
- expect(fakeReporter.reportRunnerStarting).toHaveBeenCalled();
233
- var reportedRunner = fakeReporter.reportRunnerStarting.mostRecentCall.args[0];
234
- expect(reportedRunner.arbitraryVariable).toEqual('foo');
235
- expect(runner.queue.start).toHaveBeenCalled();
236
- });
237
-
238
- describe("when suites are nested", function() {
239
- var suite1, suite2, suite3;
240
-
241
- function suiteNames(suites) {
242
- var suiteDescriptions = [];
243
- for (var i = 0; i < suites.length; i++) {
244
- suiteDescriptions.push(suites[i].getFullName());
245
- }
246
- return suiteDescriptions;
247
- }
248
-
249
- beforeEach(function() {
250
- suite1 = env.describe("suite 1", function() {
251
- suite2 = env.describe("suite 2", function() {
252
- });
253
- });
254
- suite3 = env.describe("suite 3", function() {});
255
- });
256
-
257
- it("#suites should return a flat array of all suites, including nested suites", function() {
258
- var suites = env.currentRunner().suites();
259
- expect(suiteNames(suites)).toEqual([suite1.getFullName(), suite2.getFullName(), suite3.getFullName()]);
260
- });
261
-
262
- it("#topLevelSuites should return a flat array of all top-level suites only", function() {
263
- var suites = env.currentRunner().topLevelSuites();
264
- expect(suiteNames(suites)).toEqual([suite1.getFullName(), suite3.getFullName()]);
265
- });
266
- });
267
- });