I can\'t seem to get the following integration test to pass in an express project using mocha, supertest, and should (and coffeescript).
The test<
describe 'authentication', ->
describe 'POST /sessions', ->
describe 'success', (done) ->
it 'displays a flash', (done) ->
request(app)
.post('/sessions')
.type('form')
.field('user', 'username')
.field('password', 'password')
.redirects(1)
.end (err, res) ->
res.text.should.include('logged in')
done()
The redirects()
will follow the redirect so you can do your usual view tests.