From 2916a8a1ffea04a654beedd99589ceaa9e2727ca Mon Sep 17 00:00:00 2001 From: "Davis W. Frank and Sheel Choksi" Date: Mon, 1 Jul 2013 15:55:43 -0700 Subject: [PATCH] Cleaning up explicit dependencies --- lib/jasmine-core/jasmine.js | 20 ++++++++++++-------- src/core/matchers/requireMatchers.js | 4 ++-- src/core/matchers/toBeNaN.js | 2 +- src/core/matchers/toHaveBeenCalled.js | 2 +- src/core/matchers/toHaveBeenCalledWith.js | 2 +- src/core/matchers/toThrow.js | 2 +- src/core/matchers/toThrowError.js | 2 +- src/core/requireCore.js | 2 +- 8 files changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index c0667933..717b5100 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -52,12 +52,12 @@ getJasmineRequireObj().core = function(jRequire) { j$.Suite = jRequire.Suite(); j$.version = jRequire.version(); - j$.matchers = jRequire.requireMatchers(jRequire); + j$.matchers = jRequire.requireMatchers(jRequire, j$); return j$; }; -getJasmineRequireObj().requireMatchers = function(jRequire) { +getJasmineRequireObj().requireMatchers = function(jRequire, j$) { var availableMatchers = [ "toBe", "toBeCloseTo", @@ -81,7 +81,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire) { for (var i = 0; i < availableMatchers.length; i++) { var name = availableMatchers[i]; - matchers[name] = jRequire[name](); + matchers[name] = jRequire[name](j$); } return matchers; @@ -735,6 +735,10 @@ getJasmineRequireObj().Any = function() { if (this.expectedObject == Object) { return typeof other == 'object'; } + + if (this.expectedObject == Boolean) { + return typeof other == 'boolean'; + } return other instanceof this.expectedObject; }; @@ -1827,7 +1831,7 @@ getJasmineRequireObj().toBeLessThan = function() { return toBeLessThan; }; -getJasmineRequireObj().toBeNaN = function() { +getJasmineRequireObj().toBeNaN = function(j$) { function toBeNaN() { return { @@ -1933,7 +1937,7 @@ getJasmineRequireObj().toEqual = function() { return toEqual; }; -getJasmineRequireObj().toHaveBeenCalled = function() { +getJasmineRequireObj().toHaveBeenCalled = function(j$) { function toHaveBeenCalled() { return { @@ -1962,7 +1966,7 @@ getJasmineRequireObj().toHaveBeenCalled = function() { return toHaveBeenCalled; }; -getJasmineRequireObj().toHaveBeenCalledWith = function() { +getJasmineRequireObj().toHaveBeenCalledWith = function(j$) { function toHaveBeenCalledWith(util) { return { @@ -2008,7 +2012,7 @@ getJasmineRequireObj().toMatch = function() { return toMatch; }; -getJasmineRequireObj().toThrow = function() { +getJasmineRequireObj().toThrow = function(j$) { function toThrow(util) { return { @@ -2055,7 +2059,7 @@ getJasmineRequireObj().toThrow = function() { return toThrow; }; -getJasmineRequireObj().toThrowError = function() { +getJasmineRequireObj().toThrowError = function(j$) { function toThrowError (util) { return { compare: function(actual) { diff --git a/src/core/matchers/requireMatchers.js b/src/core/matchers/requireMatchers.js index 1766a715..33234c62 100644 --- a/src/core/matchers/requireMatchers.js +++ b/src/core/matchers/requireMatchers.js @@ -1,4 +1,4 @@ -getJasmineRequireObj().requireMatchers = function(jRequire) { +getJasmineRequireObj().requireMatchers = function(jRequire, j$) { var availableMatchers = [ "toBe", "toBeCloseTo", @@ -22,7 +22,7 @@ getJasmineRequireObj().requireMatchers = function(jRequire) { for (var i = 0; i < availableMatchers.length; i++) { var name = availableMatchers[i]; - matchers[name] = jRequire[name](); + matchers[name] = jRequire[name](j$); } return matchers; diff --git a/src/core/matchers/toBeNaN.js b/src/core/matchers/toBeNaN.js index f9a09d74..a8b0c270 100644 --- a/src/core/matchers/toBeNaN.js +++ b/src/core/matchers/toBeNaN.js @@ -1,4 +1,4 @@ -getJasmineRequireObj().toBeNaN = function() { +getJasmineRequireObj().toBeNaN = function(j$) { function toBeNaN() { return { diff --git a/src/core/matchers/toHaveBeenCalled.js b/src/core/matchers/toHaveBeenCalled.js index e63a755b..8e96d8bc 100644 --- a/src/core/matchers/toHaveBeenCalled.js +++ b/src/core/matchers/toHaveBeenCalled.js @@ -1,4 +1,4 @@ -getJasmineRequireObj().toHaveBeenCalled = function() { +getJasmineRequireObj().toHaveBeenCalled = function(j$) { function toHaveBeenCalled() { return { diff --git a/src/core/matchers/toHaveBeenCalledWith.js b/src/core/matchers/toHaveBeenCalledWith.js index 37f8462a..a57688ea 100644 --- a/src/core/matchers/toHaveBeenCalledWith.js +++ b/src/core/matchers/toHaveBeenCalledWith.js @@ -1,4 +1,4 @@ -getJasmineRequireObj().toHaveBeenCalledWith = function() { +getJasmineRequireObj().toHaveBeenCalledWith = function(j$) { function toHaveBeenCalledWith(util) { return { diff --git a/src/core/matchers/toThrow.js b/src/core/matchers/toThrow.js index 8e6b5afb..1079148c 100644 --- a/src/core/matchers/toThrow.js +++ b/src/core/matchers/toThrow.js @@ -1,4 +1,4 @@ -getJasmineRequireObj().toThrow = function() { +getJasmineRequireObj().toThrow = function(j$) { function toThrow(util) { return { diff --git a/src/core/matchers/toThrowError.js b/src/core/matchers/toThrowError.js index 212fe22e..0fe1e125 100644 --- a/src/core/matchers/toThrowError.js +++ b/src/core/matchers/toThrowError.js @@ -1,4 +1,4 @@ -getJasmineRequireObj().toThrowError = function() { +getJasmineRequireObj().toThrowError = function(j$) { function toThrowError (util) { return { compare: function(actual) { diff --git a/src/core/requireCore.js b/src/core/requireCore.js index 96da2d76..29e47717 100644 --- a/src/core/requireCore.js +++ b/src/core/requireCore.js @@ -30,7 +30,7 @@ getJasmineRequireObj().core = function(jRequire) { j$.Suite = jRequire.Suite(); j$.version = jRequire.version(); - j$.matchers = jRequire.requireMatchers(jRequire); + j$.matchers = jRequire.requireMatchers(jRequire, j$); return j$; };