Remove use of globals in the tests

Refs #563

Also @e3c4459 fixes #490. There I moved expect method to QUnit.assert to let me namepace all `expect` methods to `assert.expect` (in @9de89cb).

Each change is commit separated for reviewing purposes.