From 60f513cbff1e48701cbc27177794c225d16827cf Mon Sep 17 00:00:00 2001 From: ragaskar Date: Thu, 30 Jul 2009 22:31:57 -0700 Subject: [PATCH] minor Spec refactor --- src/Env.js | 2 +- src/Spec.js | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Env.js b/src/Env.js index 851adce..12525ae 100644 --- a/src/Env.js +++ b/src/Env.js @@ -80,7 +80,7 @@ jasmine.Env.prototype.it = function(description, func) { this.currentSpec = spec; if (func) { - spec.addToQueue(func); + spec.runs(func); } return spec; diff --git a/src/Spec.js b/src/Spec.js index ab443cc..7648971 100644 --- a/src/Spec.js +++ b/src/Spec.js @@ -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; };