2 * Temporary - The lord of tmp.
4 * Author: Veselin Todorov <hi@vesln.com>
5 * Licensed under the MIT License.
11 var fs = require('fs');
12 var path = require('path');
13 var existsSync = fs.existsSync || path.existsSync;
15 var Tempdir = require('../lib/dir');
16 var sinon = require('sinon');
17 var should = require('chai').should();
19 describe('Tempdir', function() {
20 it('should create file', function() {
21 var tmp = new Tempdir('foo');
22 existsSync(tmp.path).should.be.ok;
25 describe('rmdir', function() {
26 it('should remove the directory', function() {
27 var tmp = new Tempdir('foo');
28 sinon.spy(fs, 'rmdir');
30 fs.rmdir.getCall(0).args[0].should.eql(tmp.path);
35 describe('rmdirSync', function() {
36 it('should remove the directory', function() {
37 var tmp = new Tempdir('foo');
38 sinon.spy(fs, 'rmdirSync');
40 fs.rmdirSync.getCall(0).args[0].should.eql(tmp.path);
41 fs.rmdirSync.restore();