Move next spec/next suite ids into closure
No longer exposing these from the environment
This commit is contained in:
@@ -5,14 +5,6 @@ describe("Env", function() {
|
||||
env = new j$.Env();
|
||||
});
|
||||
|
||||
describe('ids', function() {
|
||||
it('nextSpecId should return consecutive integers, starting at 0', function() {
|
||||
expect(env.nextSpecId()).toEqual('spec0');
|
||||
expect(env.nextSpecId()).toEqual('spec1');
|
||||
expect(env.nextSpecId()).toEqual('spec2');
|
||||
});
|
||||
});
|
||||
|
||||
describe("reporting", function() {
|
||||
var fakeReporter;
|
||||
|
||||
|
||||
@@ -26,13 +26,10 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
"specDone"
|
||||
]);
|
||||
|
||||
this.lastUpdate = 0;
|
||||
this.specFilter = function() {
|
||||
return true;
|
||||
};
|
||||
|
||||
this.nextSpecId_ = 0;
|
||||
this.nextSuiteId_ = 0;
|
||||
this.equalityTesters_ = [];
|
||||
|
||||
var customEqualityTesters = [];
|
||||
@@ -42,6 +39,16 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
j$.Expectation.addCoreMatchers(j$.matchers);
|
||||
|
||||
var nextSpecId = 0;
|
||||
var getNextSpecId = function() {
|
||||
return 'spec' + nextSpecId++;
|
||||
};
|
||||
|
||||
var nextSuiteId = 0;
|
||||
var getNextSuiteId = function() {
|
||||
return 'suite' + nextSuiteId++;
|
||||
};
|
||||
|
||||
var expectationFactory = function(actual, spec) {
|
||||
return j$.Expectation.Factory({
|
||||
util: j$.matchersUtil,
|
||||
@@ -133,7 +140,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
totalSpecsDefined++;
|
||||
|
||||
var spec = new j$.Spec({
|
||||
id: self.nextSpecId(),
|
||||
id: getNextSpecId(),
|
||||
beforeFns: beforeFns(suite),
|
||||
afterFns: afterFns(suite),
|
||||
expectationFactory: expectationFactory,
|
||||
@@ -183,7 +190,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
this.topSuite = new j$.Suite({
|
||||
env: this,
|
||||
id: this.nextSuiteId(),
|
||||
id: getNextSuiteId(),
|
||||
description: 'Jasmine__TopLevel__Suite',
|
||||
queueRunner: queueRunnerFactory,
|
||||
completeCallback: function() {}, // TODO - hook this up
|
||||
@@ -195,7 +202,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
this.suiteFactory = function(description) {
|
||||
var suite = new suiteConstructor({
|
||||
env: self,
|
||||
id: self.nextSuiteId(),
|
||||
id: getNextSuiteId(),
|
||||
description: description,
|
||||
parentSuite: self.currentSuite,
|
||||
queueRunner: queueRunnerFactory,
|
||||
@@ -273,16 +280,6 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
return j$.version;
|
||||
};
|
||||
|
||||
// TODO: move this to closure
|
||||
Env.prototype.nextSpecId = function() {
|
||||
return 'spec' + this.nextSpecId_++;
|
||||
};
|
||||
|
||||
// TODO: move this to closure
|
||||
Env.prototype.nextSuiteId = function() {
|
||||
return 'suite' + this.nextSuiteId_++;
|
||||
};
|
||||
|
||||
// TODO: move this to closure
|
||||
Env.prototype.addReporter = function(reporter) {
|
||||
this.reporter.addReporter(reporter);
|
||||
|
||||
Reference in New Issue
Block a user