Skip to content

Commit

Permalink
Remove files after tests
Browse files Browse the repository at this point in the history
  • Loading branch information
imZack committed Dec 23, 2014
1 parent 7e0e669 commit ec1b87a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ PuppetMaster.prototype.createRequest = function createRequest(req, res) {
request;

if (!data.destination || !data.message || !this.vaildMessage(data.message)) {
console.log(data);
return res.status(400).json({
message: 'Invaild destnation or message'
});
Expand Down
2 changes: 1 addition & 1 deletion lib/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Job.prototype.save = function(path) {
};

Job.prototype.load = function(path) {
return (new Storage('/tmp').load(path));
return (new Storage('/tmp/puppetmaster').load(path));
};

module.exports = Job;
8 changes: 4 additions & 4 deletions lib/storage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var crypto = require("crypto");
var fs = require("fs");
var crypto = require("crypto"),
fs = require("fs");

var driver = {
memory: (function() {
Expand Down Expand Up @@ -66,7 +66,7 @@ var Storage = function(options) {
continue;
}
this[prop] = currentDriver[prop];
}
}
};

module.exports = Storage;
module.exports = Storage;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"istanbul": "^0.3.2",
"mocha": "^1.21.5",
"mocha-lcov-reporter": "0.0.1",
"rimraf": "^2.2.8",
"should": "^4.0.4",
"sinon": "^1.10.3",
"socket.io": "^1.2.1",
Expand Down
1 change: 0 additions & 1 deletion test/test-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ describe('PuppetMaster', function() {
.expect('Content-Type', /json/)
.end(function(err, res) {
if (err) {
console.log(err);
return done(err);
}

Expand Down
32 changes: 28 additions & 4 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,19 @@ describe('Job', function() {
});

describe('save/load', function() {
var j = new Job({destinations: destinations, message: request});
var filename;
var j = new Job({destinations: destinations, message: request}),
rimraf = require('rimraf'),
fs = require('fs'),
filename;

beforeEach(function(done) {
fs.mkdir('/tmp/puppetmaster', function() {
done();
});
});

it('should be able to save as a file', function() {
filename = j.save('/tmp');
filename = j.save('/tmp/puppetmaster');
});

it('should be able to load as a file', function() {
Expand All @@ -295,6 +304,21 @@ describe('Job', function() {
});

describe('Storage', function() {
var rimraf = require('rimraf'),
fs = require('fs');

beforeEach(function(done) {
fs.mkdir('/tmp/puppetmaster', function() {
done();
});
});

afterEach(function(done) {
rimraf('/tmp/puppetmaster', function() {
done();
});
});

describe('create a storage instance (memory)', function() {
var s = new Storage();
it('should be created as a storage instance', function() {
Expand All @@ -309,7 +333,7 @@ describe('Storage', function() {
});

describe('create a storage instance (file)', function() {
var s = new Storage('/tmp');
var s = new Storage('/tmp/puppetmaster');
it('should be created as a storage instance', function() {
s.should.be.a.Storage;
s.connection.type.should.be.equal('file');
Expand Down

0 comments on commit ec1b87a

Please sign in to comment.