iammerrick/Squire.js — pull request #26 by jonotron (2013-04-24 17:11:44+00:00)
Title: Implement AMD constructors that can be used with `new`

`Helpers.returns` creates a function that returns the `what`. Since require modules are invoked as functions, requiring the module mocked with `Helpers.returns` will be the mock instance rather than a constructor function, making it unusable with `new`.

Wrapping in one more function allows for proper constructors.

So now you can do this:

```javascript
injector.mock('Views/AwesomeView', Squire.Helpers.constructs(mockViewInstance));
```

`Views/AwesomeView` is now defined as a function that returns a constructor function that returns the `what`

whereas using `Helpers.returns` defines `Views/AwesomeView` as a function that returns the `what`

I've set this as a new method, `Helpers.constructs`, instead of overriding `returns` to maintain backwards compatibility.

Thoughts?