diff --git a/spec/core/EnvSpec.js b/spec/core/EnvSpec.js index 935f48d0..61c52511 100644 --- a/spec/core/EnvSpec.js +++ b/spec/core/EnvSpec.js @@ -82,8 +82,8 @@ describe("Env", function() { describe('#it', function () { it('throws an error when it receives a non-fn argument', function() { expect(function() { - env.it('undefined arg', undefined); - }).toThrowError(/it expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/); + env.it('undefined arg', null); + }).toThrowError(/it expects a function argument; received \[object (Null|DOMWindow|Object)\]/); }); it('does not throw when it is not given a fn argument', function() { @@ -105,8 +105,8 @@ describe("Env", function() { it('throws an error when it receives a non-fn argument', function() { expect(function() { - env.xit('undefined arg', undefined); - }).toThrowError(/xit expects a function argument; received \[object (Undefined|DOMWindow|Object)\]/); + env.xit('undefined arg', null); + }).toThrowError(/xit expects a function argument; received \[object (Null|DOMWindow|Object)\]/); }); it('does not throw when it is not given a fn argument', function() { diff --git a/src/core/Env.js b/src/core/Env.js index 0f4198e1..f5877d92 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -452,7 +452,7 @@ getJasmineRequireObj().Env = function(j$) { this.it = function(description, fn, timeout) { // it() sometimes doesn't have a fn argument, so only check the type if // it's given. - if (arguments.length > 1) { + if (arguments.length > 1 && typeof fn !== 'undefined') { ensureIsFunction(fn, 'it'); } var spec = specFactory(description, fn, currentDeclarationSuite, timeout); @@ -466,7 +466,7 @@ getJasmineRequireObj().Env = function(j$) { this.xit = function(description, fn, timeout) { // xit(), like it(), doesn't always have a fn argument, so only check the // type when needed. - if (arguments.length > 1) { + if (arguments.length > 1 && typeof fn !== 'undefined') { ensureIsFunction(fn, 'xit'); } var spec = this.it.apply(this, arguments);