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