Add more spec tests, fix encapsulation.

Never depend on a resource created in another class,
always depend on the class itself.