diff --git a/lib/runnable.js b/lib/runnable.js index 64de4e9a20..bba47d9542 100644 --- a/lib/runnable.js +++ b/lib/runnable.js @@ -96,7 +96,7 @@ Runnable.prototype.timeout = function(ms) { * @return {Runnable|number} ms or Runnable instance. */ Runnable.prototype.slow = function(ms) { - if (!arguments.length) { + if (typeof ms === 'undefined') { return this._slow; } if (typeof ms === 'string') { diff --git a/test/runnable.js b/test/runnable.js index af34d06474..a3d88adda2 100644 --- a/test/runnable.js +++ b/test/runnable.js @@ -49,12 +49,27 @@ describe('Runnable(title, fn)', function(){ }); }); - describe('#slow(ms)', function(){ - it('should set the slow threshold', function(){ - var run = new Runnable; - run.slow(100) + describe('#slow(ms)', function() { + var run; + + beforeEach(function() { + run = new Runnable(); + }); + + it('should set the slow threshold', function() { + run.slow(100); run.slow().should.equal(100); - }) + }); + + it('should not set the slow threshold if the parameter is not passed', function() { + run.slow(); + run.slow().should.equal(75); + }); + + it('should not set the slow threshold if the parameter is undefined', function() { + run.slow(undefined); + run.slow().should.equal(75); + }); }) describe('.title', function(){