Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #379 from dcneiner/should-primitive-fix

Getter for Should syntax now uses valueOf for primitives
  • Loading branch information...
commit 2cad0dcbba8f68871767c56cacb1aa5f136e7cc1 2 parents 09e17b9 + ef04544
Keith Cirkel keithamus authored
Showing with 2 additions and 4 deletions.
  1. +2 −4 lib/chai/interface/should.js
6 lib/chai/interface/should.js
View
@@ -10,10 +10,8 @@ module.exports = function (chai, util) {
function loadShould () {
// explicitly define this method as function as to have it's name to include as `ssfi`
function shouldGetter() {
- if (this instanceof String || this instanceof Number) {
- return new Assertion(this.constructor(this), null, shouldGetter);
- } else if (this instanceof Boolean) {
- return new Assertion(this == true, null, shouldGetter);
+ if (this instanceof String || this instanceof Number || this instanceof Boolean ) {
+ return new Assertion(this.valueOf(), null, shouldGetter);
}
return new Assertion(this, null, shouldGetter);
}
Please sign in to comment.
Something went wrong with that request. Please try again.