Skip to content

Commit

Permalink
chore(tests): Finish Controller unit tests fixes #97
Browse files Browse the repository at this point in the history
  • Loading branch information
pilsy committed Jun 24, 2014
1 parent 6855b52 commit 1868b4b
Show file tree
Hide file tree
Showing 4 changed files with 775 additions and 48 deletions.
11 changes: 7 additions & 4 deletions tests/unit/test-module/controllers/TestController.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ module.exports = function ( Controller, TestService ) {
service: TestService
},
{
putAction: function() {
this.putCalled = true;
return this._super.apply( this, arguments );
}
customAction: function() {
this.send( { message: 'Hello from customAction' }, 200 );
},

hidden: function() {
this.send( { message: 'You will never see the contents of this function via the browser!' }, 200 );
}
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = function ( Controller ) {
var middlewareWasCalled = false;
return Controller.extend(
{
route: '/testcustomroute|/testcustomroutes',

autoRouting: [ 'middlewareTester' ],

middlewareTester: function( req, res, next ) {
middlewareWasCalled = true;
next();
}
},
{
listAction: function() {
this.send( { message: 'Hello from TestMiddlewareAndRouteController' }, 200 );
}
});
};
Loading

0 comments on commit 1868b4b

Please sign in to comment.