Code review: move validator to lib/validators; move test class definition to spec file