diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-03-23 23:32:07 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-03-23 23:32:07 +0100 |
commit | 868a3186dd40e57ec1c38174be1db28dfd4c85c4 (patch) | |
tree | 6900fdf85bbd0f11caa9814c661ce2f03f26b4f6 /test/assertions.js | |
parent | 17b546181c0af8f3086fdf1b38b39a2bee7155e4 (diff) | |
download | gitbook-868a3186dd40e57ec1c38174be1db28dfd4c85c4.zip gitbook-868a3186dd40e57ec1c38174be1db28dfd4c85c4.tar.gz gitbook-868a3186dd40e57ec1c38174be1db28dfd4c85c4.tar.bz2 |
Add assertion to test that a file exists
Diffstat (limited to 'test/assertions.js')
-rw-r--r-- | test/assertions.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/assertions.js b/test/assertions.js new file mode 100644 index 0000000..b40a518 --- /dev/null +++ b/test/assertions.js @@ -0,0 +1,11 @@ +var fs = require('fs'); +var path = require('path'); +var should = require('should'); + +should.Assertion.add('file', function(file, description) { + this.params = { operator: 'have file ' + file, message: description }; + + this.obj.should.have.property('options').which.is.an.Object; + this.obj.options.should.have.property('output').which.is.a.String; + this.assert(fs.existsSync(path.resolve(this.obj.options.output, file))); +}); |