Skip to content

Commit

Permalink
specs for pidfile
Browse files Browse the repository at this point in the history
  • Loading branch information
sdepold committed Sep 11, 2012
1 parent e6febb6 commit ac7a0a2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
},
"devDependencies": {
"buster": "~0.6.2",
"express-test-bot": "~0.3.0"
"express-test-bot": "~0.3.1"
}
}
55 changes: 29 additions & 26 deletions spec/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('ImageableServer', function() {
describe('pidfile', function() {
before(function() {
this.exists = require('fs').exists || require('path').exists
this.pidfile = process.cwd() + "tmp/node_imageable_server.pid"
this.pidfile = process.cwd() + "/tmp/node_imageable_server.pid"
})

it("has no pidfile when server is stopped", function(done) {
Expand All @@ -106,31 +106,34 @@ describe('ImageableServer', function() {
})
})

it("//creates a pidfile on server start", function(done) {
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.server.get('/', function() {})
this.exists(this.pidfile, function(exists) {
expect(exists).toBeTrue()
done()
})
it("creates a pidfile on server start", function(done) {
var killServer = this.server.killServer

this.server.killServer = function() {
this.exists(this.pidfile, function(exists) {
expect(exists).toBeTrue()
killServer.call(this.server)

done()
}.bind(this))
}.bind(this)

this.server.get('/', function(){})
})

it("removes the pidfile after the server was stopped", function(done) {
var killServer = this.server.killServer

this.server.killServer = function() {
killServer.call(this.server, function() {
this.exists(this.pidfile, function(exists) {
expect(exists).toBeFalse()
done()
}.bind(this))
}.bind(this))
}.bind(this)

this.server.get('/', function(){})
})
})
})

0 comments on commit ac7a0a2

Please sign in to comment.