Fix: testing account switch

This commit is contained in:
2015-10-09 13:58:16 +00:00
parent 69570d8702
commit f55f3e1eba
2 changed files with 19 additions and 7 deletions

View File

@@ -22,6 +22,9 @@ describe('GlobalController', function() {
beforeEach(inject(function ( _$rootScope_, $controller, _$location_) {
$location = _$location_;
$rootScope = _$rootScope_;
$rootScope.globals = {
user: true
};
$scope = _$rootScope_.$new();
createController = function() {
@@ -39,5 +42,16 @@ describe('GlobalController', function() {
globalController.change_account();
$location.path().should.be.equal('/account/560a84058812ad8d0ff200ee')
}));
it('should change successfully', inject(function($location, $rootScope) {
var globalController = createController();
globalController.current_account = '560a84058812ad8d0ff200ee';
globalController.change_account();
$rootScope.current_account = '560a7ad08812ad8d0ff20068';
$rootScope.$digest();
globalController.change_account();
$rootScope.$digest();
$location.path().should.be.equal('/account/560a7ad08812ad8d0ff20068')
}));
});