shuriken 0.1.2.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +28 -0
- data/coffeescripts/shuriken/test/assertions.coffee +111 -0
- data/coffeescripts/shuriken/test/reporters.coffee +61 -0
- data/coffeescripts/shuriken/test.coffee +117 -0
- data/coffeescripts/shuriken.coffee +2 -2
- data/javascripts/shuriken/mixins/callbacks.js +45 -0
- data/javascripts/shuriken/mixins.js +58 -0
- data/javascripts/shuriken/test/assertions.js +117 -0
- data/javascripts/shuriken/test/reporters.js +84 -0
- data/javascripts/shuriken/test.js +165 -0
- data/javascripts/shuriken.js +195 -0
- data/lib/shuriken.rb +1 -1
- data/shuriken.gemspec +84 -4
- data/tests/basic_namespace_tests.coffee +114 -0
- data/tests/template.erb +26 -0
- data/tests.watchr +6 -0
- data/vendor/jasmine-0.10.0/MIT.LICENSE +20 -0
- data/vendor/jasmine-0.10.0/README.markdown +437 -0
- data/vendor/jasmine-0.10.0/doc/files.html +460 -0
- data/vendor/jasmine-0.10.0/doc/index.html +322 -0
- data/vendor/jasmine-0.10.0/doc/symbols/_global_.html +918 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Block.html +417 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Clock.html +678 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Env.html +1169 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.JsApiReporter.html +822 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Matchers.html +1461 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.MultiReporter.html +394 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.NestedResults.html +710 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Reporter.html +574 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Runner.html +710 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Spec.html +1259 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Spy.html +855 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.Suite.html +705 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.html +1345 -0
- data/vendor/jasmine-0.10.0/doc/symbols/jasmine.util.html +535 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/lib_TrivialReporter.js.html +124 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_Block.js.html +29 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_Env.js.html +240 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_JsApiReporter.js.html +111 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_Matchers.js.html +328 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_MultiReporter.js.html +36 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_NestedResults.js.html +88 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_PrettyPrinter.js.html +130 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_Queue.js.html +102 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_Reporter.js.html +35 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_Reporters.js.html +51 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_Runner.js.html +75 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_Spec.js.html +211 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_Suite.js.html +77 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_WaitsBlock.js.html +21 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_WaitsForBlock.js.html +45 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_base.js.html +555 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_mock-timeout.js.html +185 -0
- data/vendor/jasmine-0.10.0/doc/symbols/src/src_util.js.html +75 -0
- data/vendor/jasmine-0.10.0/example/example_runner.html +25 -0
- data/vendor/jasmine-0.10.0/example/spec/example_suite.js +11 -0
- data/vendor/jasmine-0.10.0/lib/TrivialReporter.js +117 -0
- data/vendor/jasmine-0.10.0/lib/consolex.js +28 -0
- data/vendor/jasmine-0.10.0/lib/jasmine-0.10.0.js +2261 -0
- data/vendor/jasmine-0.10.0/lib/jasmine.css +86 -0
- data/vendor/jasmine-0.10.0/spec/runner.html +63 -0
- data/vendor/jasmine-0.10.0/spec/suites/CustomMatchersSpec.js +112 -0
- data/vendor/jasmine-0.10.0/spec/suites/EnvSpec.js +71 -0
- data/vendor/jasmine-0.10.0/spec/suites/ExceptionsSpec.js +107 -0
- data/vendor/jasmine-0.10.0/spec/suites/JsApiReporterSpec.js +82 -0
- data/vendor/jasmine-0.10.0/spec/suites/MatchersSpec.js +589 -0
- data/vendor/jasmine-0.10.0/spec/suites/MockClockSpec.js +34 -0
- data/vendor/jasmine-0.10.0/spec/suites/MultiReporterSpec.js +30 -0
- data/vendor/jasmine-0.10.0/spec/suites/NestedResultsSpec.js +54 -0
- data/vendor/jasmine-0.10.0/spec/suites/PrettyPrintSpec.js +93 -0
- data/vendor/jasmine-0.10.0/spec/suites/QueueSpec.js +23 -0
- data/vendor/jasmine-0.10.0/spec/suites/ReporterSpec.js +60 -0
- data/vendor/jasmine-0.10.0/spec/suites/RunnerSpec.js +258 -0
- data/vendor/jasmine-0.10.0/spec/suites/SpecRunningSpec.js +1086 -0
- data/vendor/jasmine-0.10.0/spec/suites/SpecSpec.js +110 -0
- data/vendor/jasmine-0.10.0/spec/suites/SpySpec.js +187 -0
- data/vendor/jasmine-0.10.0/spec/suites/SuiteSpec.js +101 -0
- data/vendor/jasmine-0.10.0/spec/suites/TrivialReporterSpec.js +140 -0
- data/vendor/jasmine-0.10.0/spec/suites/UtilSpec.js +23 -0
- data/vendor/jquery.js +154 -0
- data/wip-coffeescripts/example_test.coffee +0 -0
- data/wip-coffeescripts/test/assertions.coffee +111 -0
- data/wip-coffeescripts/test/reporters.coffee +61 -0
- data/wip-coffeescripts/test.coffee +96 -15
- metadata +83 -4
@@ -0,0 +1,54 @@
|
|
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
|
+
});
|
@@ -0,0 +1,93 @@
|
|
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 window objects", function() {
|
73
|
+
expect(jasmine.pp(window)).toEqual("<window>");
|
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
|
+
|
@@ -0,0 +1,23 @@
|
|
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
|
+
});
|
@@ -0,0 +1,60 @@
|
|
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
|
+
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
|
50
|
+
});
|
51
|
+
|
52
|
+
var runner = env.currentRunner();
|
53
|
+
runner.execute();
|
54
|
+
|
55
|
+
expect(foo).toEqual(3); // 'foo was expected to be 3, was ' + foo);
|
56
|
+
expect(bar).toEqual(2); // 'bar was expected to be 2, was ' + bar);
|
57
|
+
expect(baz).toEqual(1); // 'baz was expected to be 1, was ' + baz);
|
58
|
+
});
|
59
|
+
|
60
|
+
});
|
@@ -0,0 +1,258 @@
|
|
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).wasNotCalled();
|
214
|
+
fakeTimer.tick(200);
|
215
|
+
//This blows up the JSApiReporter.
|
216
|
+
//expect(fakeReporter.reportRunnerResults).wasCalledWith(env.currentRunner);
|
217
|
+
expect(fakeReporter.reportRunnerResults).wasCalled();
|
218
|
+
expect(fakeReporter.reportRunnerResults.mostRecentCall.args[0].results()).toEqual(env.currentRunner().results());
|
219
|
+
});
|
220
|
+
|
221
|
+
|
222
|
+
});
|
223
|
+
|
224
|
+
it("should report when the tests start running", function() {
|
225
|
+
var fakeReporter = jasmine.createSpyObj("fakeReporter", ["log", "reportRunnerStarting"]);
|
226
|
+
env.addReporter(fakeReporter);
|
227
|
+
|
228
|
+
|
229
|
+
var runner = new jasmine.Runner(env);
|
230
|
+
runner.arbitraryVariable = 'foo';
|
231
|
+
spyOn(runner.queue, 'start');
|
232
|
+
expect(fakeReporter.reportRunnerStarting).wasNotCalled();
|
233
|
+
runner.execute();
|
234
|
+
expect(fakeReporter.reportRunnerStarting).wasCalled();
|
235
|
+
var reportedRunner = fakeReporter.reportRunnerStarting.mostRecentCall.args[0];
|
236
|
+
expect(reportedRunner.arbitraryVariable).toEqual('foo');
|
237
|
+
expect(runner.queue.start).wasCalled();
|
238
|
+
|
239
|
+
});
|
240
|
+
|
241
|
+
it("should return a flat array of all suites, including nested suites", function() {
|
242
|
+
var suite1, suite2;
|
243
|
+
suite1 = env.describe("spec 1", function() {
|
244
|
+
suite2 = env.describe("nested spec", function() {
|
245
|
+
});
|
246
|
+
});
|
247
|
+
|
248
|
+
document.runner = env.currentRunner();
|
249
|
+
|
250
|
+
var suites = env.currentRunner().suites();
|
251
|
+
var suiteDescriptions = [];
|
252
|
+
for (var i = 0; i < suites.length; i++) {
|
253
|
+
suiteDescriptions.push(suites[i].getFullName());
|
254
|
+
}
|
255
|
+
expect(suiteDescriptions).toEqual([suite1.getFullName(), suite2.getFullName()]);
|
256
|
+
});
|
257
|
+
|
258
|
+
});
|