Written with the idea of being simple to use.
passportStub = require 'passport-stub'request = require 'supertest'app = require '../app'passportStubinstall appreq = request appdescribe 'GET /admin'->it 'responds with 401 if not logged in'reqget'/admin'expect401end doneit 'responds with 200 when logged in'passportStublogin username: 'john.doe'reqget'/admin'expect200end done
The user you log in with can be whatever user your app would expect to deal with. It could be a mongoose model, for example.
Although I didn't use, I've included a few other functions that might be useful. The code itself is pretty simple, so take a look at it.
passport-stub's versions are not backwards compatible, so check this list out (hopefully it won't grow any longer):
Bottom line: try to keep your deps updated. :-)
This is licensed under the feel-free-to-do-whatever-you-want-to-do license.