Comparing version
@@ -0,1 +1,6 @@ | ||
2.1.0 / 2013-11-11 | ||
================== | ||
* Override .inspect for Date's to convert them to ISOString | ||
2.0.2 / 2013-10-21 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -27,3 +27,6 @@ /*! | ||
should.inspect = inspect; | ||
should.inspect = function(obj, opts) { | ||
if(util.isDate(obj) && typeof obj.inspect !== 'function') obj = obj.toISOString(); | ||
return inspect(obj, opts); | ||
}; | ||
@@ -30,0 +33,0 @@ /** |
{ "name": "should" | ||
, "description": "test framework agnostic BDD-style assertions" | ||
, "version": "2.0.2" | ||
, "version": "2.1.0" | ||
, "author": "TJ Holowaychuk <tj@vision-media.ca>" | ||
@@ -5,0 +5,0 @@ , "repository": { "type": "git", "url": "git://github.com/visionmedia/should.js.git" } |
@@ -45,4 +45,14 @@ # should.js | ||
Some assertions can be chained, for example if a property is volatile we can first assert property existence: | ||
Every assertion will return a should.js-wraped Object, so assertions can be chained. For example: | ||
```js | ||
user.should.be.an.instanceOf(Object).and.have.property('name', 'tj'); | ||
user.pets.should.be.instanceof(Array).and.have.lengthOf(4); | ||
``` | ||
All assertions return themselves but not `property` and `ownProperty`. They two would return the property value. | ||
for example if a property is volatile we can first assert property existence: | ||
```javascript | ||
// `user.should.have.property('pets')` returned `should(user.pets)` but not `should(user)` | ||
user.should.have.property('pets').with.lengthOf(4) | ||
@@ -54,3 +64,4 @@ ``` | ||
``` | ||
our dummy getters such as _a_, _an_, _be_ and _have_ make tests more readable while the getters _and_ and _with_ helps express chaining: | ||
our dummy getters such as _a_, _an_, _be_, _of_ and _have_ make tests more readable while the getters _and_ and _with_ helps express chaining: | ||
```javascript | ||
@@ -60,2 +71,3 @@ user.should.be.an.instanceOf(Object).and.have.property('name', 'tj') | ||
``` | ||
Those getters don't have any actual effect, just for readability. | ||
@@ -162,4 +174,4 @@ ## static | ||
```javascript | ||
user.should.have.type('object') | ||
'test'.should.have.type('string') | ||
user.should.be.type('object') | ||
'test'.should.be.type('string') | ||
``` | ||
@@ -166,0 +178,0 @@ ## instanceof and instanceOf |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
138592
0.1%3097
0.32%453
2.72%