dmarcos/gaia — pull request #11 by wilsonpage (2013-12-09 11:51:35+00:00)
Title: Reshuffle of architecture to move away from singleton modules

This is a rather large PR, but it turned out to be one of the those chain reaction type issues. My aim was to move away from the singleton module pattern towards all modules being instantiable classes, this is great for unit testing, and makes working with state and references really easy.

For example, in our unit tests for some controller, we can just instantiate a brand new fresh controller for each test without having to remember to restore any internal state that may have changed as a result of the test run. Also because all methods are on the prototype we can easily spy/stub methods that might have previously been inaccessible to us inside module closures.