Created
November 15, 2013 23:19
-
-
Save jonnybojangles/7493371 to your computer and use it in GitHub Desktop.
Testing controllers that are not declared globally: angular.module().controller();
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('widget.controllers', []). | |
controller('mainCtrl', ['$scope', function($scope){ | |
$scope.test = 'this is a test'; | |
}]); | |
/* | |
* Testing a controller created with angular.module().controller(); | |
* */ | |
describe('Testing controllers created via module\'s controller', function(){ | |
"use strict"; | |
beforeEach(module('widget.controllers')); | |
describe('mainCtrl', function(){ | |
it('Test hardcoded scope variables are correctly hardcoded.', inject(function($rootScope, $controller){ | |
var scope = $rootScope.$new(), | |
ctrl = $controller('mainCtrl', { $scope: scope }); | |
expect(scope.test).toBe('this is a test'); | |
})); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment