From e40e0c917011a98ab32ef879efae36737ab76d14 Mon Sep 17 00:00:00 2001 From: Albert Andrejev Date: Fri, 21 Jun 2013 15:07:55 +0300 Subject: [PATCH] jasmine.any Boolean support --- spec/core/AnySpec.js | 6 ++++++ src/core/Any.js | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/spec/core/AnySpec.js b/spec/core/AnySpec.js index 97b1c247..cb965c1d 100644 --- a/spec/core/AnySpec.js +++ b/spec/core/AnySpec.js @@ -22,6 +22,12 @@ describe("Any", function() { expect(any.jasmineMatches({})).toBe(true); }); + + it("matches a Boolean", function() { + var any = new j$.Any(Boolean); + + expect(any.jasmineMatches(true)).toBe(true); + }); it("matches another constructed object", function() { var Thing = function() {}, diff --git a/src/core/Any.js b/src/core/Any.js index d2739015..71886b34 100644 --- a/src/core/Any.js +++ b/src/core/Any.js @@ -20,6 +20,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; };