I have a controller created with angular.module().controller() like in this situation
myModule = angular.module('myApp.controllers', [])
.controller('testCtrl', ['$scope', function($scope){
$scope.test = 'this is a test';
}]);
now, I need to use mocha to test if my controller is working properly. In Angular there are some examples when controllers are declared as global functions ( ex. http://docs.angularjs.org/tutorial/step_04 ), so they use
function PhoneListCtrl() {...}
.....
beforeEach(function() {
scope = {},
ctrl = new PhoneListCtrl(scope);
});
it('shod test whatever PhoneListCtrl does ', function() {
expect(scope.someProp).toBe('whateverValue');
});
so the questions are:
1) how can I do a similar test for controllers that are declared using angular.module().controller()
2) how to do it using Mocha