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;
if (func) {
spec.addToQueue(func);
spec.runs(func);
}
return spec;

View File

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