<commit_before>describe('permissions service (ngImprovedTesting spec)', function() {

    beforeEach(ModuleBuilder.forModule('myApp')
        .serviceWithMocks('permissions')
        //TODO: make controller with mocks working
//        .controllerWithMocks('AppCtrl')
        .filterWithMocks('fullname')
        .build());

    describe('hasAdminAccess method', function() {

        it('should return true when user details has property: admin == true', inject(function(usersMock, permissions) {
            usersMock.getUserDetails.andReturn({admin: true});

            expect(permissions.hasAdminAccess('anAdminUser')).toBe(true);
        }));
    });

    describe('AppCtrl controller', function() {
        var $scope;

        beforeEach(inject(function($rootScope, $controller) {
            $scope = $rootScope.$new();

            $controller('AppCtrl', {$scope: $scope});
        }));


        describe('$scope', function() {

            describe('loggedInUserHasAdminAccess method', function() {
                //TODO: make controller with mocks working
                xit('should use permissions#hasAdminAccess and the logged in user', inject(function(permissionsMock) {
                    $scope.login('anAdminUser');
                    permissionsMock.hasAdminAccess.andReturn(true);

                    expect($scope.loggedInUserHasAdminAccess()).toBe(true);
                    expect(permissionsMock.hasAdminAccess).toHaveBeenCalledWith('anAdminUser');
                }));
            });
        });
    });

    describe('Fullname filter', function() {

        it('should return the fullname for a user name', inject(function (usersMock, fullnameFilter) {
            usersMock.getUserDetails.andReturn({fullname: 'an admin user'});

            expect(fullnameFilter('anAdminUser')).toBe('an admin user');
            expect(usersMock.getUserDetails).toHaveBeenCalledWith('anAdminUser');
        }));
    });

});
<commit_msg>Included earlier excluded "controller with mocks" test (as its now working as expected)<commit_after>describe('permissions service (ngImprovedTesting spec)', function() {

    beforeEach(ModuleBuilder.forModule('myApp')
        .serviceWithMocks('permissions')
        .controllerWithMocks('AppCtrl')
        .filterWithMocks('fullname')
        .build());

    describe('hasAdminAccess method', function() {

        it('should return true when user details has property: admin == true', inject(function(usersMock, permissions) {
            usersMock.getUserDetails.andReturn({admin: true});

            expect(permissions.hasAdminAccess('anAdminUser')).toBe(true);
        }));
    });

    describe('AppCtrl controller', function() {
        var $scope;

        beforeEach(inject(function($rootScope, $controller) {
            $scope = $rootScope.$new();

            $controller('AppCtrl', {$scope: $scope});
        }));


        describe('$scope', function() {

            describe('loggedInUserHasAdminAccess method', function() {
                it('should use permissions#hasAdminAccess and the logged in user', inject(function(permissionsMock) {
                    $scope.login('anAdminUser');
                    permissionsMock.hasAdminAccess.andReturn(true);

                    expect($scope.loggedInUserHasAdminAccess()).toBe(true);
                    expect(permissionsMock.hasAdminAccess).toHaveBeenCalledWith('anAdminUser');
                }));
            });
        });
    });

    describe('Fullname filter', function() {

        it('should return the fullname for a user name', inject(function (usersMock, fullnameFilter) {
            usersMock.getUserDetails.andReturn({fullname: 'an admin user'});

            expect(fullnameFilter('anAdminUser')).toBe('an admin user');
            expect(usersMock.getUserDetails).toHaveBeenCalledWith('anAdminUser');
        }));
    });

});

{'fraction_non_alphanumeric': 0.13161290322580646, 'fraction_numerical': 0.0, 'mean_word_length': 2.737704918032787, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2544996', 'n_tokens_mistral': 994, 'n_tokens_neox': 964, 'n_words': 184}