Respect Global State When Running Tests

There were a lot of things that were eagerly running before tests. These
should be wrapped in Moacha's `beforeEach` hook. This prevents an issue
such as the following:

```
Uncaught TypeError: undefined is not a function tests.js:5
```

In truth, there's a deeper loading issue to resolve. This problem would
have cropped up sooner or later anyways.