Rename Suite.children_ to .children

Also removed some unit tests that were brittle, and already tested by
better, more round-trip tests.
This commit is contained in:
Sheel Choksi and Tim Jarratt
2013-10-25 10:25:50 -07:00
parent 243ff80196
commit 26581b4c91
2 changed files with 7 additions and 60 deletions

View File

@@ -67,54 +67,6 @@ describe("Suite", function() {
expect(suite.afterFns).toEqual([innerAfter, outerAfter]);
});
it("adds specs", function() {
var env = new j$.Env(),
fakeQueue = {
add: jasmine.createSpy()
},
suite = new j$.Suite({
env: env,
description: "I am a suite",
queueFactory: function() {
return fakeQueue
}
}),
fakeSpec = {};
expect(suite.children_.length).toEqual(0);
suite.addSpec(fakeSpec);
expect(suite.children_.length).toEqual(1);
});
it("adds suites", function() {
var env = new j$.Env(),
fakeQueue = {
add: jasmine.createSpy()
},
suite = new j$.Suite({
env: env,
description: "I am a suite",
queueFactory: function() {
return fakeQueue
}
}),
anotherSuite = new j$.Suite({
env: env,
description: "I am another suite",
queueFactory: function() {
return fakeQueue
}
});
expect(suite.children_.length).toEqual(0);
suite.addSuite(anotherSuite);
expect(suite.children_.length).toEqual(1);
});
it("can be disabled", function() {
var env = new j$.Env(),
fakeQueueRunner = jasmine.createSpy('fake queue runner'),

View File

@@ -13,7 +13,7 @@ getJasmineRequireObj().Suite = function() {
this.queueRunner = attrs.queueRunner || function() {};
this.disabled = false;
this.children_ = []; // TODO: rename
this.children = [];
this.result = {
id: this.id,
@@ -46,16 +46,12 @@ getJasmineRequireObj().Suite = function() {
};
Suite.prototype.addSpec = function(spec) {
this.children_.push(spec);
this.children.push(spec);
};
Suite.prototype.addSuite = function(suite) {
suite.parentSuite = this;
this.children_.push(suite);
};
Suite.prototype.children = function() {
return this.children_;
this.children.push(suite);
};
Suite.prototype.execute = function(onComplete) {
@@ -65,11 +61,10 @@ getJasmineRequireObj().Suite = function() {
return;
}
var allFns = [],
children = this.children_;
var allFns = [];
for (var i = 0; i < children.length; i++) {
allFns.push(wrapChildAsAsync(children[i]));
for (var i = 0; i < this.children.length; i++) {
allFns.push(wrapChildAsAsync(this.children[i]));
}
this.onStart(this);
@@ -91,7 +86,7 @@ getJasmineRequireObj().Suite = function() {
return function(done) { child.execute(done); };
}
};
return Suite;
};