minor Spec refactor

This commit is contained in:
ragaskar 2009-07-30 22:31:57 -07:00
parent f84c67b98a
commit 60f513cbff
2 changed files with 10 additions and 12 deletions

View File

@ -80,7 +80,7 @@ jasmine.Env.prototype.it = function(description, func) {
this.currentSpec = spec; this.currentSpec = spec;
if (func) { if (func) {
spec.addToQueue(func); spec.runs(func);
} }
return spec; return spec;

View File

@ -18,7 +18,6 @@ jasmine.Spec = function(env, suite, description) {
this.results = new jasmine.NestedResults(); this.results = new jasmine.NestedResults();
this.results.description = description; this.results.description = description;
this.runs = this.addToQueue;
this.matchersClass = null; this.matchersClass = null;
}; };
@ -30,16 +29,17 @@ jasmine.Spec.prototype.getResults = function() {
return this.results; return this.results;
}; };
jasmine.Spec.prototype.addToQueue = function(func) { jasmine.Spec.prototype.runs = function (func) {
var block = new jasmine.Block(this.env, func, this); var block = new jasmine.Block(this.env, func, this);
this.addToQueue(block);
this.setNextOnLastInQueue(block);
this.queue.push(block);
return this; return this;
}; };
jasmine.Spec.prototype.addToQueue = function(block) {
this.setNextOnLastInQueue(block);
this.queue.push(block);
};
/** /**
* @private * @private
* @deprecated * @deprecated
@ -72,8 +72,7 @@ jasmine.Spec.prototype.setNextOnLastInQueue = function (block) {
*/ */
jasmine.Spec.prototype.waits = function(timeout) { jasmine.Spec.prototype.waits = function(timeout) {
var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this); var waitsFunc = new jasmine.WaitsBlock(this.env, timeout, this);
this.setNextOnLastInQueue(waitsFunc); this.addToQueue(waitsFunc);
this.queue.push(waitsFunc);
return this; return this;
}; };
@ -82,8 +81,7 @@ jasmine.Spec.prototype.waits = function(timeout) {
*/ */
jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) { jasmine.Spec.prototype.waitsFor = function(timeout, latchFunction, timeoutMessage) {
var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this); var waitsForFunc = new jasmine.WaitsForBlock(this.env, timeout, latchFunction, timeoutMessage, this);
this.setNextOnLastInQueue(waitsForFunc); this.addToQueue(waitsForFunc);
this.queue.push(waitsForFunc);
return this; return this;
}; };