So I am creating a service which sends a message to the backend to check whether a particular email address is already on the database.
userDB.emailExists = function()
{
    var returnVal;
    $http.get('?backend=users&email=myemail%40mydomain.com')
         .success(function(data) { returnVal = data.count ? true : false; })
         .error(function(data) { /* TODO error handling */ });
        returnVal = data.count ? true : false;
    });
    return returnVal;
};
Now currently the unit test for this (testing to see whether the function returns true or false) is failing with Expected undefined to be truthy.. I think I get why; as a promise only returns a 'placeholder' so at the time we get to the 'return' statement, returnVal has not been set yet. 
Only problem is, I don't know how to fix this; I don't want to return the promise as this seems an unnecessary layer of complexity when the result is a simple true or false
 
     
    