Refactor tests with database access

Testing specs with required database access have been refactored to use a new
testing Global object that sets the DatabaseProfile database to DB("test") at
startup (whenever a "WithApplication" is created).