global.controller.spec.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. describe('GlobalController', function() {
  2. var $location,
  3. $rootScope,
  4. $scope,
  5. createController,
  6. DEFAULT_ACCOUNTS = [
  7. {
  8. "_id": "560a84058812ad8d0ff200ee",
  9. "name": "foo",
  10. "reference": "baz",
  11. "user_id": "55b78934d2a706265ea28e9c"
  12. }, {
  13. "_id": "560a7ad08812ad8d0ff20068",
  14. "name": "bar",
  15. "user_id": "55b78934d2a706265ea28e9c"
  16. }
  17. ];
  18. beforeEach(module('cloudbudget'));
  19. beforeEach(inject(function ( _$rootScope_, $controller, _$location_) {
  20. $location = _$location_;
  21. $rootScope = _$rootScope_;
  22. $scope = _$rootScope_.$new();
  23. createController = function() {
  24. return $controller('GlobalController', {
  25. '$scope': $scope,
  26. '$location': $location,
  27. '$rootScope': $rootScope
  28. });
  29. };
  30. }));
  31. it('should init successfully', inject(function($location, $rootScope) {
  32. var globalController = createController();
  33. globalController.current_account = '560a84058812ad8d0ff200ee';
  34. globalController.change_account();
  35. $location.path().should.be.equal('/account/560a84058812ad8d0ff200ee')
  36. }));
  37. });