Here is my route module:
var routes = angular.module('myRoutes', ['ngRoute']);
routes.config([ '$routeProvider', function($routeProvider)
{
$routeProvider.when('/dashboard',
{
templateUrl : 'dashboard.html',
controller : 'myCtrl',
requiresLogin: true
}).when('/login', {
templateUrl : 'login.html',
controller : 'LoginCtrl'
}).when('/logout', {
templateUrl: 'login.html',
controller : 'LoginCtrl'
});
} ]);
Here is my roueSpec.js which I intended to use to unit test the route.js:
//user angular-route library
describe('route testing', function(){
angular.module('myRoutes');
it('should map routes',function() {
inject(function($location,$rootScope,$route) {
expect($route.current).toBeUndefined();
$location.path('/dashboard');
$rootScope.$digest();
expect($route.routes['/dashboard'].templateUrl).toEqual('dashboard.html');
})
});
});
When I run the karma.conf.js from command prompt, I am getting the following error: C:>karma start karma.conf.js
INFO [launcher]: Starting browser IE
INFO [IE 9.0.0 (Windows 7)]: Connected on socket A1MGQ6MXaamcbdZihKTp with id 15570817
IE 9.0.0 (Windows 7) route testing should map routes FAILED
Error: [$injector:unpr] Unknown provider: $routeProvider <- $route
http://errors.angularjs.org/1.2.23/$injector/unpr?p0=%24routeProvider%20%3C- %20%24route
IE 9.0.0 (Windows 7): Executed 1 of 1 (1 FAILED) ERROR (0 secs / 0.02 secs)
Please share your advice. Thanks gvhelp