3 var proxyquire = require('proxyquire').noPreserveCache();
5 var categoryCtrlStub = {
6 index: 'categoryCtrl.index',
7 show: 'categoryCtrl.show',
8 create: 'categoryCtrl.create',
9 update: 'categoryCtrl.update',
10 destroy: 'categoryCtrl.destroy'
21 // require the index with our stubbed out modules
22 var categoryIndex = proxyquire('./index.js', {
28 './category.controller': categoryCtrlStub
31 describe('Category API Router:', function() {
33 it('should return an express router instance', function() {
34 categoryIndex.should.equal(routerStub);
37 describe('GET /api/categories', function() {
39 it('should route to category.controller.index', function() {
41 .withArgs('/', 'categoryCtrl.index')
42 .should.have.been.calledOnce;
47 describe('GET /api/categories/:id', function() {
49 it('should route to category.controller.show', function() {
51 .withArgs('/:id', 'categoryCtrl.show')
52 .should.have.been.calledOnce;
57 describe('POST /api/categories', function() {
59 it('should route to category.controller.create', function() {
61 .withArgs('/', 'categoryCtrl.create')
62 .should.have.been.calledOnce;
67 describe('PUT /api/categories/:id', function() {
69 it('should route to category.controller.update', function() {
71 .withArgs('/:id', 'categoryCtrl.update')
72 .should.have.been.calledOnce;
77 describe('PATCH /api/categories/:id', function() {
79 it('should route to category.controller.update', function() {
81 .withArgs('/:id', 'categoryCtrl.update')
82 .should.have.been.calledOnce;
87 describe('DELETE /api/categories/:id', function() {
89 it('should route to category.controller.destroy', function() {
91 .withArgs('/:id', 'categoryCtrl.destroy')
92 .should.have.been.calledOnce;