From 5d6cd00ec068746c3092f97c56796a754d0f81a1 Mon Sep 17 00:00:00 2001 From: Veselin Todorov Date: Sat, 25 Feb 2012 20:25:32 +0200 Subject: [PATCH] Fix type of actual checks. --- lib/assertion.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/assertion.js b/lib/assertion.js index 921ab32..899d860 100644 --- a/lib/assertion.js +++ b/lib/assertion.js @@ -47,6 +47,7 @@ var AssertionError = require('./error') , eql = require('./utils/eql') + , toString = Object.prototype.toString , inspect = require('./utils/inspect'); /*! @@ -72,6 +73,7 @@ function Assertion (obj, msg, stack) { /*! * ## Assertion.includeStack + * , toString = Object.prototype.toString * * User configurable property, influences whether stack trace * is included in Assertion error message. Default of false @@ -535,8 +537,10 @@ Assertion.prototype.within = function (start, finish) { */ Assertion.prototype.a = function (type) { + var klass = type.charAt(0).toUpperCase() + type.slice(1); + this.assert( - type == typeof this.obj + '[object ' + klass + ']' === toString.call(this.obj) , 'expected ' + this.inspect + ' to be a ' + type , 'expected ' + this.inspect + ' not to be a ' + type);