bring in basic controller testing. NOTE: changes solve Mongo Session issue,

Error: Error setting TTL index on collection : sessions
    at /Users/weston/git/hackathon-starter/node_modules/connect-mongo/lib/connect-mongo.js:161:23
    at /Users/weston/git/hackathon-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1404:28
    at /Users/weston/git/hackathon-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1542:30
    at /Users/weston/git/hackathon-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:159:22
    at commandHandler (/Users/weston/git/hackathon-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:678:48)
    at /Users/weston/git/hackathon-starter/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1806:9
pull/2/head
Weston Platter 2014-02-24 23:15:55 -07:00
parent 400de520c6
commit 3dc900b725
3 changed files with 22 additions and 4 deletions

5
app.js
View File

@ -34,12 +34,13 @@ var passportConf = require('./config/passport');
*/
var app = express();
module.exports = app;
/**
* Mongoose configuration.
*/
mongoose.connect(secrets.db);
mongoose.connect(secrets.url);
mongoose.connection.on('error', function() {
console.error('✗ MongoDB Connection Error. Please make sure MongoDB is running.');
});
@ -71,7 +72,7 @@ app.use(express.methodOverride());
app.use(express.session({
secret: secrets.sessionSecret,
store: new MongoStore({
db: mongoose.connection.db,
url: secrets.url,
auto_reconnect: true
})
}));

View File

@ -42,6 +42,7 @@
},
"devDependencies": {
"chai": "~1.9.0",
"mocha": "~1.17.1"
"mocha": "~1.17.1",
"supertest": "~0.9.0"
}
}

View File

@ -0,0 +1,16 @@
process.env.NODE_ENV = 'test';
var request = require('supertest')
, express = require('express')
, mocha = require('mocha')
, app = require('../../app.js');
describe('GET /', function(){
it('should return HTTP 200', function(done){
request(app)
.get('/')
.expect(200, done);
});
});