Fix type of actual checks.

This commit is contained in:
Veselin Todorov 2012-02-25 20:25:32 +02:00
parent 567656290b
commit 5d6cd00ec0

View file

@ -47,6 +47,7 @@
var AssertionError = require('./error') var AssertionError = require('./error')
, eql = require('./utils/eql') , eql = require('./utils/eql')
, toString = Object.prototype.toString
, inspect = require('./utils/inspect'); , inspect = require('./utils/inspect');
/*! /*!
@ -72,6 +73,7 @@ function Assertion (obj, msg, stack) {
/*! /*!
* ## Assertion.includeStack * ## Assertion.includeStack
* , toString = Object.prototype.toString
* *
* User configurable property, influences whether stack trace * User configurable property, influences whether stack trace
* is included in Assertion error message. Default of false * is included in Assertion error message. Default of false
@ -535,8 +537,10 @@ Assertion.prototype.within = function (start, finish) {
*/ */
Assertion.prototype.a = function (type) { Assertion.prototype.a = function (type) {
var klass = type.charAt(0).toUpperCase() + type.slice(1);
this.assert( this.assert(
type == typeof this.obj '[object ' + klass + ']' === toString.call(this.obj)
, 'expected ' + this.inspect + ' to be a ' + type , 'expected ' + this.inspect + ' to be a ' + type
, 'expected ' + this.inspect + ' not to be a ' + type); , 'expected ' + this.inspect + ' not to be a ' + type);