Example #1
0
 topic: function() {
   var self = this;
   var mockRes = {};
   mockRes.setHeader = function(field, value) {
     this.header = this.header || {};
     this.header[field] = value;
   }
   mockRes.end = function() {
     self.callback(null, this);
   }
   
   var context = {};
   context.res = mockRes;
   
   var redirect = actions.redirect.bind(context);
   process.nextTick(function () {
     redirect('http://www.example.com/login');
   });
 },
Example #2
0
 topic: function() {
   var self = this;
   var mockRes = {};
   mockRes.redirect = function(status, url) {
     if (!url) {
       url = status;
       status = 302;
     }
     this.statusCode = status;
     this.header = 'Location: ' + url;
     self.callback(null, this);
   }
   
   var context = {};
   context.res = mockRes;
   
   var redirect = actions.redirect.bind(context);
   process.nextTick(function () {
     redirect('http://www.example.com/login');
   });
 },