PHP Classes

File: public/js/lib/director/test/server/http/methods-test.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy   Silex MVC Blog   public/js/lib/director/test/server/http/methods-test.js   Download  
File: public/js/lib/director/test/server/http/methods-test.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Silex MVC Blog
MVC based blog using on the Silex micro-framework
Author: By
Last change:
Date: 8 years ago
Size: 1,293 bytes
 

Contents

Class file image Download
/* * methods-test.js: Tests for HTTP methods. * * (C) 2011, Charlie Robbins, Paolo Fragomeni, & the Contributors. * MIT LICENSE * */ var assert = require('assert'), vows = require('vows'), director = require('../../../lib/director'); vows.describe('director/http/methods').addBatch({ "When using director": { "an instance of director.http.Router should have all relevant RFC methods": function () { var router = new director.http.Router(); director.http.methods.forEach(function (method) { assert.isFunction(router[method.toLowerCase()]); }); }, "the path() method": { topic: new director.http.Router(), "/resource": { "should insert nested routes correct": function (router) { function getResource() {} function modifyResource() {} router.path(/\/resource/, function () { this.get(getResource); this.put(/\/update/, modifyResource); this.post(/create/, modifyResource); }); assert.equal(router.routes.resource.get, getResource); assert.equal(router.routes.resource.update.put, modifyResource); assert.equal(router.routes.resource.create.post, modifyResource); } } } } }).export(module);