before(function(done) { chai.locomotive.helper(patternHelper.path('/bands/:band_id/albums/:id'), 'test', 'show') .req(function(req) { req.headers.host = 'www.example.com'; }) .create(function(err, helper) { if (err) { return done(err); } pathHelper = helper; return done(); }); });
before(function(done) { chai.locomotive.dynamicHelper(patternHelper.url('/bands/:band_id/albums/:id', 'bandAlbum'), 'test', 'show') .app(function(app) { app.helper('bandAlbumPath', patternHelper.path('/bands/:band_id/albums/:id')); }).req(function(req) { req.headers.host = 'www.example.com'; }) .create(function(err, helper) { if (err) { return done(err); } urlHelper = helper; return done(); }); });
before(function(done) { chai.locomotive.helper(helpers.linkTo, 'test', 'show') .app(function(app) { app.route('/profile', 'profile', 'show'); app.route('/animals/:id', 'animals', 'show'); app.helper('animalURL', function(obj) { return this.urlFor({ controller: 'animals', action: 'show', id: obj.id }); }); app.helper('animalPath', function(obj) { return this.urlFor({ controller: 'animals', action: 'show', id: obj.id, onlyPath: true }); }); app.dynamicHelper('urlFor', dynamicHelpers.urlFor); }) .req(function(req) { req.headers.host = 'www.example.com'; }) .create(function(err, helper) { if (err) { return done(err); } linkTo = helper; return done(); }); });