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