diff --git a/test/server/common.coffee b/test/server/common.coffee index dc01d8389..d80548aa3 100644 --- a/test/server/common.coffee +++ b/test/server/common.coffee @@ -9,6 +9,10 @@ jasmine.getEnv().addReporter(new jasmine.SpecReporter({ displaySuccessfulSpec: true, displayFailedSpec: true })) + +rep = new jasmine.JsApiReporter() +jasmine.getEnv().addReporter(rep) + GLOBAL._ = require('lodash') _.str = require('underscore.string') _.mixin(_.str.exports()) @@ -149,3 +153,13 @@ _drop = (done) -> chunks = mongoose.connection.db.collection('media.chunks') chunks.remove {}, -> done() + +tickInterval = null +tick = -> + # When you want jasmine-node to exit after running the tests, + # you have to close the connection first. + if rep.finished + mongoose.disconnect() + clearTimeout tickInterval + +tickInterval = setInterval tick, 1000 \ No newline at end of file diff --git a/test/server/functional/auth.spec.coffee b/test/server/functional/auth.spec.coffee index 15ef44171..35bd0660f 100644 --- a/test/server/functional/auth.spec.coffee +++ b/test/server/functional/auth.spec.coffee @@ -6,9 +6,8 @@ urlLogin = getURL('/auth/login') urlReset = getURL('/auth/reset') describe '/auth/whoami', -> - http = require 'http' it 'returns 200', (done) -> - http.get(getURL('/auth/whoami'), (response) -> + request.get(getURL('/auth/whoami'), (err, response) -> expect(response).toBeDefined() expect(response.statusCode).toBe(200) done() diff --git a/test/server/integration/models/Level.spec.coffee b/test/server/integration/models/Level.spec.coffee index 7cbc286d7..e74daaccb 100644 --- a/test/server/integration/models/Level.spec.coffee +++ b/test/server/integration/models/Level.spec.coffee @@ -18,13 +18,3 @@ describe 'Level', -> level.save (err) -> throw err if err done() - - it 'loads again after being saved', (done) -> - url = getURL('/db/level/'+level._id) - request.get url, (err, res, body) -> - expect(res.statusCode).toBe(200) - sameLevel = JSON.parse(body) - expect(sameLevel.name).toEqual(level.get 'name') - expect(sameLevel.description).toEqual(level.get 'description') - expect(sameLevel.permissions).toEqual(simplePermissions) - done()