angular/angular.js — pull request #7806 by wesalvaro (2014-06-12 15:43:59+00:00)
Title: feat(mocks): Injected function(s) now return value(s).

I just ran into this problem:

```javascript
describe('foo', function() {
// Create a scope and setup the module...

var createController = inject(function($controller) {
return $controller('Foo', {scope: scope});
});

it('should create the controller', function() {
var ctrl = createController();
expect(ctrl).not.toBeUndefined(); // FAIL
});
});
```

I was trying to do some setup on a fake injected service in my spec before creating the controller.

It turns out that inject may return a function, but that function does not return anything, so the return of my controller goes nowhere. The `Injector.invoke` call does return the value of the invoked function, so in this commit, I simply pass it back from `inject`. If more than one function is used in `inject`, then an array of return values is passed back.

I'm not sure if there is something I'm missing, so I would love to hear what you think about this change. I think that it makes the `inject` function work as expected.